Interrupt on change always being called

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
I have an interrupt on change event for 3 pins on a p18f14k22. RB4, RB5 and RB6 all have a pullup resistor with N.O. push buttons connecting to ground on press.

On RB4 it is working as expected. I get two interrupts. One on the press and one one the release, But for RB5 and RB6, I only get an interrupt when the push button is released. I don't get one on press.

I will post schematic and code later if requested. Just wanted to post this to see if any one knows right off what could be causing this issue.
 

Ian Rogers

Joined Dec 12, 2012
1,136
When the interrupt occurs you MUST read PORTB to clear any mis-matching of the port

The last known port condition is OR'd with the new state so If you don't physically read the port the change may be not what you expect...
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
l am reading port B. Sorry for the incorrect subject. This was my orginal issue. Can a mod please change it to "Interrupt on change only being called once"?
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
I see what I was doing wrong. I was reading the port 3 times. I was reading each pin one at a time. Apparently this causes issues.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Sorry I thought that was clear above. I do have another related issue but I think I will start another thread.
 
Top