Hello I'm working on a bluetooth to MCU interface project to receive a stream of bytes and act accordingly ( like switching on a Relay or so on ) on a msp-exp430g2 with a msp430g2553 ic.
I'm able to receive buff_rxTemp[1],buff_rxTemp[2] but all other values are junk.Other thing that I noticed is that buff_rxCnt jumps to 52 quite consistently from 2 and never counts to 3 to 52.Therefore values between 3 and 52 are always '\0'.
Is there any problem with my code.
#include <msp430.h>
/*
* main.c
*/
unsigned char buff_rxTemp[];
unsigned char buff_rx[];
unsigned int buff_rxCnt=0;
unsigned int i;
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |=BIT6;
P1OUT &=BIT6;
P1DIR |=BIT0;
P1OUT &=BIT0;
DCOCTL = 0; // Select lowest DCOx and MODx settings<
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
P1SEL= BIT1 + BIT2 ;
P1SEL2= BIT1 +BIT2;
UCA0CTL1|= UCSSEL_2;
UCA0BR0= 104;
UCA0BR1= 0;
UCA0MCTL= UCBRF_0 + UCBRS_1 ;
UCA0CTL1&= ~UCSWRST;
IE2|= UCA0RXIE;
__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ int until Byte RXed
while(1){
}
}
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void) {
buff_rxTemp[i]= UCA0RXBUF;
i++;
}