HSEROUT operates in a continuous loop until the last byte is sent.
First it tests the TXIF flag to see if the buffer is empty, when the buffer is empty, it then
loads the outbound byte into TXREG, and returns for the next byte until all bytes are sent.
After loading the last byte into TXREG and returning, depending on the baud rate, the PIC
can normally execute several thousand instructions while the last byte is still in the process
of being transmitted by the hardware UART. But it's still a continuous software loop until it
reaches the last byte, and passes it to the TXREG.
HSERIN is also a continuous software loop until all bytes have been received. RCIF is set
when the stop bit is received, and the new byte is transferred from the RSR register into
RCREG.
RCIF will remain set until all bytes have been read from RCREG, then RCIF is cleared in
hardware.
A receive interrupt only happens if you have the receive interrupt enabled. RCIF gets set
regardless, and can only be cleared by reading RCREG, and emptying the FIFO buffer.
Bookmarks