pic interrupt question

Thread Starter

RobbJohnson

Joined Dec 15, 2009
76
I am receiving rs232 data on a 16f873 via max232 on port RC7which does not have interupt.
i only get data sometimes once a month sometimes 1 a second.

Can I tie port RB4 which has intrupt-on-change to RC7 so i can use sleep?
 

JohnInTX

Joined Jun 26, 2012
4,787
Personally, I'd use the external interrupt pin to make it easier but RBIF would work as well as long as other RBx inputs won't interfere with the interrupt on change while you are sleeping.

Pay attention to how to sleep the processor as described in Sec 14 of the datasheet. Clear the interrupt flag(s) and clear the WDT before sleeping. After waking, disable the interrupt and service it. Keep in mind that it takes 1024 oscillator cycles to begin processing after waking up and the UART will not be able to receive characters while sleeping / waking up. You will not be able to use the serial data that woke up the processor. Consider sending some dummy data or a BREAK to wake it up. Check the UART flags and clear any OERR/FERR after waking up.

Have fun.
 
Top