EmbeddedRelated.com
Forums

Uart Software using Timer_A Library from TI

Started by ferdinando_terada August 31, 2009
hey guys, i'm with a problem using the TI's library to create a UART by software (http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=slaa307a).
I'll put my code for you to see:

---------------------------------
#include "msp430x22x4.h"
#include "ta_uart.h"

int callBack( unsigned char c );

void main (void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

TI_initTimer(callBack, _1MHz_SMCLK_09600_Bitime, TASSEL_1);
_EINT();

TI_TX_Byte( 0x7E );
TI_TX_Byte( 0 );
TI_TX_Byte( 5 );
TI_TX_Byte( 0x08 );
TI_TX_Byte( 0x01 );
TI_TX_Byte( 0x43 );
TI_TX_Byte( 0x45 );
TI_TX_Byte( 0x01 );
TI_TX_Byte( 0x6D );

LPM3;

}

int callBack( unsigned char c )
{
TI_TA_UART_StatusFlags &= ~TI_TA_RX_RECEIVED; // allows for RX during TX (will not effect TXed byte)
TI_TX_Byte( c ); // echo byte
return TA_UART_STAY_LPM; // return to LPM3
}
---------------------------------
I'm using the msp430f2274... so all i change in the .h file is the device and the ports to use the timer A (in msp430f2274 P2.3 and P2.4 correspond to Timer A). But i can't receive anything. i don't know where is the problem (i'm using a Xbee to test the interface... so when i send those bytes to Xbee i had to receive something by uart but none is coming back, help me please)
see yah!

Beginning Microcontrollers with the MSP430