Trying to understand UART example, need help

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to understand UART example, need help

200 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zmogedra on Tue Jan 29 09:25:26 MST 2013
Hi I'm totally new to LPC 1100. Now I am trying to understand UART  example and make a simple program to receive command from UART to turn  on the LED on the board. In the example UART echo is handle like in this  sequence:

1. UART appropriate pins are turned on.
2. UART clock is enabled.
3. Stop and parity bits are set.
4. UART appropriate dividers are written for desired baud rate.
5. FIFO is enabled.
6. UART interrupts are turned on.

And then everything goes through interrupt handler.

My  first question is do you really need interrupt handler if you want to  read RX?? Can you just check in a while loop for UART_LSR first bit goes  to 1 which means data is ready for read in RBR.

Other question  is if you configure UART_IER  when what is the difference between  IIR_RDA flag Receive Data Available ant LSR_RDR flag Receive Data Ready? 


Man... LPC UART is much harder then atmel avr..;]
Thank you for your answers.
0 Kudos
1 Reply

166 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jan 30 12:39:42 MST 2013
[FONT=Tahoma][SIZE=2]Don't know about IIR but yes, if you want to write your code that way you don't have to enable interrupts,  you can just poll reading the uart status.

Normally, with larger applications, there is so much else going on that you will miss characters because you can't poll quickly enough.
[/SIZE][/FONT]
0 Kudos