I am working on a project involving two 16F88 chips. I am using the hardware usart. I need to put the chips to sleep and have them wake up with the interrupt pin RB0 or the RX interrupt.
This is part of the code
Main_Prog:
IF MAIN_INT THEN ' RB0 HIGH
GOSUB Handle_Buttons
ENDIF
IF PIR1.5 THEN ' USART RECIEVE INTERRUPT FLAG
GOSUB Rx_Sub
ENDIF
INTCON = %11010000 ' SET GIE, PEIE, AND INTE
PIE1 = %00100000 ' SET RCIE
PIR1 = %00000000 ' CLEAR INTERRUPT FLAGS
OPTION_REG = %11000000 'PULL UPS ENABLED
@ SLEEP
GOTO Main_Prog
If I take all the code from intcon to @sleep out (last 5 lines in Main_Prog), then it works perfectly, however, as soon as I start putting those lines back in, I get different, inconsisten results each time.
It appears that the RB0 interrupt works, however, the chip will never wake up with the USART Recieve Interrupt. It also appears that with the sleep in there, it no longer sends the usart signals.
If anyone has any ideas on what may be wrong or any tips on using the usart recieve interrupt, it would be greatly appreciated.
Thanks,
Andrew Lash
Bookmarks