Not sure about this, but gotta start somewhere.
The RX_INT is being ENABLEd before the USART registers are set-up. Or, more accurately, since HSERIN/OUT are used in the program, PBP initializes the USART first, then RX_INT is enabled, then the USART registers are changed.
It may be causing a false interrupt that sends it to the ReceiveUSART: handler, which is expecting to see 2 bytes being received, that were never sent. So it sits there.
Try using this...
Code:
DEFINE HSER_CLROERR 1 ' Hser clear overflow automatically
DEFINE HSER_RCSTA 90h ' Hser receive status init
DEFINE HSER_TXSTA 24h ' Hser transmit status init
DEFINE HSER_SPBRG 0 ' Hser spbrg init
While PIR1.5 = 1 ; clear the buffer
HSERIN [varByte]
Wend
@ INT_ENABLE RX_INT ; enable RX interrupts
In place of..
Code:
@ INT_ENABLE RX_INT ; enable RX interrupts
DEFINE HSER_SPBRG 0 ' 1250 KBAUD @ 20 MHz (CPU)
BAUDCON.3 = 0 ' BRG16 Select 8 bit baud rate generator
TXSTA.5 = 1 ' TXEN Enable USART transmitter
TXSTA.4 = 0 ' SYNC Asynchronous communication
TXSTA.2 = 1 ' BRGH High speed baud rate
RCSTA.7 = 1 ' SPEN Enable USART receiver
RCSTA.4 = 1 ' CREN Enable continuous receive
Bookmarks