I need to use the bit change interrupt feature on a PIC16F76 and determine which of 4 inputs (RB4-RB7) actally changed. I looked through a multitude of sample interrupt programs but didn't find any that deal with multiple inputs. When a bit change interrupt occurs, I don't see an easy way of determining which specific port bit changed, so the following logic seems necessary.
Store the state of all 4 (RB4-RB7) inputs
' interrupt routine
compare the 4 ports to the saved state to determine which one changed
save the input state for the next interrupt
do something in response to the bit that changed
reset the interrupt flag
resume
Is this the right way to determine which of the 4 inputs caused the interrupt?
Thanks,
PickyBiker
Bookmarks