Author: christop
Posted: 08 Nov 2012 01:24:50 pm (GMT -5)
The ISR is not blocking in the same sense that ReceiveByte is blocking. The ISR should do one thing and return as quickly as possible. It definitely should not poll, which is exactly what ReceiveByte does. It polls (in a wasteful busy loop) the receive buffer's status until a byte is received. ReceiveByte should be used only when a UART interrupt is not being used, and it definitely should not be used inside an interrupt.
_________________
Christopher Williams
Posted: 08 Nov 2012 01:24:50 pm (GMT -5)
pcb_master wrote: |
You are right that the ReceiveByte() is blocking, but the ISR is anyway. |
The ISR is not blocking in the same sense that ReceiveByte is blocking. The ISR should do one thing and return as quickly as possible. It definitely should not poll, which is exactly what ReceiveByte does. It polls (in a wasteful busy loop) the receive buffer's status until a byte is received. ReceiveByte should be used only when a UART interrupt is not being used, and it definitely should not be used inside an interrupt.
_________________
Christopher Williams