PortB change interruption

Thread Starter

a.mahesh.mrt

Joined Feb 26, 2012
1
I'm currently working on a project which try to detect the change of the PORTB using PIC16f877.but i was not able to detect that.does anyone know about the portB change interruption routine please help me.
 

ErnieM

Joined Apr 24, 2011
8,377
To use IOC features you must init the INTCON register: GIE (general) and the RBIE (RB Port Change Interrupt Enable bit) must be set.

The your ISR must first read port B to clear the mismatch, then the INTCON RBIF RB Port Change Interrupt Flag bit must be cleared. If another change occurs the change interrupt will fire immediately when you exit the ISR.

The read gives you the current value. Note for pin glitches this may be a different state then the one that fired the ISR.

ANY read or write to Port B affects the change state, and there is a small but non-zero chance accessing the port outside of the ISR will result in a missed change. There are ways to code against that if need be.
 
Top