I'm trying to learn how to use interrupts and in all the examples I find the word DISABLE appears.
But to me it doesn't appear to do anything as it is never passed by the program.
Am I being thick?
My next question is the 16f877 shows it has 14 Interrupts but the paper work only shows interrupts on some of the RB pins?
And lastly I want to use four different RBx pins to trigger four different bits of code. But looking at example and reading the paperwork I can not see how I differentiate between which pins causes the interrupt as once enabled any of the RB pins cause an interrupt? or do I have to do this in code?
I'm sure this is obvious to everyone except me but I've spent all weekend reading and can not see the wood for the trees.
Rob
***EXAMPLE*****
' On Interrupt - Interrupts in BASIC
' Turn LED on. Interrupt on PORTB.0 (INTE) turns LED off.
' Program waits .5 seconds and turns LED back on.
led var PORTB.7
OPTION_REG = $7f ' Enable PORTB pullups
On Interrupt Goto myint ' Define interrupt handler
INTCON = $90 ' Enable INTE interrupt
loop: High led ' Turn LED on
Goto loop ' Do it forever
' Interrupt handler
Disable ' No interrupts past this point
myint: Low led ' If we get here, turn LED off
Pause 500 ' Wait .5 seconds
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
Bookmarks