PIR1.5 or RCIF is a read-only bit that gets cleared once the USART RCREG buffer is
empty. The only way to clear RCIF is to empty the buffer by reading it.
My guess would be that you're sending more data than you're receiving in the HSERIN
routine, and this is causing the USART to lock-up. OERR (the over-run bit in RCSTA) gets
set, and this causes the USART to stop responding.
If you include the DEFINE HSER_CLROERR 1 option in the init section of your code, PBP will
automatically clear this condition for you. If not you'll need to do it manually by clearing,
then setting, CREN (bit 4 in RCSTA) register.
RCIF never gets set again once OERR is set because this condition inhibits transfer of data
from the RSR to RCREG register.
Bookmarks