Greetings All
I have managed to get an interrupt working in my program but don't fully understand it all.
It is a very simple interrupt that activates when RB0 is taken low. Pretty much out of the PBP manual.
Here is the Code that Matters:
OPTION_REG = $7f
On Interrupt Goto myint ' Define interrupt handler
INTCON = $90 ' Enable RB0 interrupt
Disable ' No interrupts past this point
myint:
Stuff happens here ......
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
My Questions Are:
OPTION_REG = $7f was in the original example I used but it seems to work fine without it. What does this do? Do I need it?
How would I create a second Interrupt say when RB1 is taken low.
$90 is %10010000 therefore is the fourth 1 the bit that refers to RB0
When I clear the flag INTCON.1 = 0 what exactly is going on here.
If Resume Returns to the main program I take it Enable never gets run.
Can anyone help me understand Interrupts better.
Bookmarks