Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 63733

Forum Post: RE: UART by software in MSP430G2553

$
0
0
Hello Hudson, the "somewhere in main" line of code is where the pointer initialized to the buffer of TX data. Come to think of it, there is an error in it! Here is the right way to do it: uchar buff_Tx[64]; uchar *ptr_Tx; uchar BiTcntr;Uchar txByte; /* Somwhere in main() */ ptr_Tx = (uchar *)buff_Tx; /********************************/ And by "somewhere in main" I mean literally somewhere in main(){...}, could be right where you initialize the IO port pins, or timer. Or even better, it can be initialized right in declaration like this: uchar buff_Tx[64]; uchar *ptr_Tx= (uchar *)buff_Tx ; uchar BiTcntr; uchar txByte; and you can skip the commented lines in main . IMPORTANT , you would need to find a right value for Baudrate constant line 30, otherwise it's 0, and the timer never kicks in. For that I would transmit 0x55, or 'U', and fine-tune the Baudrate value to have the square-wave as close as possible to similar transmitted from classical COM port. You would need an O-scope for that. For MSP430G2553 at 16 MHz I used 0x680. Hit me with your next question! Cheers, Arsen Oh, yeah #define uchar unsigned char

Viewing all articles
Browse latest Browse all 63733

Trending Articles