I am trying out Darryl Taylors Interrupts but I have a few questions, I am using a 16F628A, and Interrupt on change of Portb pins 7-4.
The first question is do I still need to set up the INTCON=%00001000, or does DT's Interrupt's take care of that.
The second question is in the main program I am trying to get the processor to sleep until there is a change on portb.
@ INT_ENABLE RBC_INT ; enable external (INT) interrupts
siesta:
@ Sleep
@ nop
GoTo siesta
After spending the last week searching the forum for some clarifications, one mentioned that portb needed to be read to see if a change occurred. How do I go about just reading the port to detect a change? What I mean is, yes I can read portb and store it as a variable but if I am constantly comparing then I won't be sleeping right? Or is there another way?
From what I gathered through the PBP manual and the forum, I need to clear the interrupt flag, intcon.1=0 but from what I can tell from DT's Interrupt's it resets the flag. Is this correct?
According to the 16F628A datasheet I only see the use of one NOP so I believe this is correct if not please correct me.
Another question is regarding the enabling the interrupt before the label. This is puzzling to me how when the interrupt is serviced then returning to the main program how would the interrupt be re-enabled. So I was thinking this:
ISR:
'go do something
trisb = $f0
portb = $1
@ INT_ENABLE RBC_INT ; enable external (INT) interrupts
@ INT_RETURN
Is this right?
And my last question is if my program is to start with let say loop: and my main will be the one called Siesta, always keeping it sleeping until a change on portb 7-4, then should I change @ INT_RETURN to @ INT_RETURN siesta?
Thanks for the help
Bookmarks