Hi,
Do we have any sample codes for MSP430 controller in which UART RX polling based instead of ISR??i have installed mspware but unable to get any UART polling based sample code..
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
Do we have any sample codes for MSP430 controller in which UART RX polling based instead of ISR??i have installed mspware but unable to get any UART polling based sample code..
Hi Vidushi!
If you want to poll for a received character, you simply have to poll for the RX interrupt flag:
uint8_t received_symbol; ... if( IFG2 & UCA0RXIFG ) { received_symbol = UCA0RXBUF; // Copy received symbol - reading RX buffer clears IFG } ...
Dennis
Yes, if you also have
BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ; // Set DCO step and modulation
at the beginning of your code, then everything looks fine. And disable or feed the watchdog, of course.
Dennis
One thing I noticed at first sight:
while( IFG2&UCA0RXIFG ) { received_symbol = UCA0RXBUF; // Copy received symbol - reading RX buffer clears IFG }
If you want to wait until something is inside the buffer, you have to write:
while( !(IFG2 & UCA0RXIFG) ); // Wait until a symbol was received received_symbol = UCA0RXBUF; // Copy received symbol - reading RX buffer clears IFG
I don't know if this is what you wanted to do?
Dennis
**Attention** This is a public forum