Hello interrupt experts,
I need some clarifications on Interrupts. I am reading a GREAT book on PicBasic called PicBasic Projecs by Dogan Ibrahim. He does explain the ENABLE and DISABLE commands but something doesn't make sense. Please look at the code below.
'Main Program
ON INTERRUPT GOTO XYZ
**********
*MAIN *
*PROGRAM *
*CODE *
*HERE *
**********
DISABLE ' DISABLE INTERRUPTS
XYZ:
**********
*INTERRUPT*
*CODE *
*HERE *
**********
RESUME 'RETURN TO CODE WHERE INTERRUPT OCCURRED
ENABLE ' ALLOW INTERRUPTS TO HAPPEN
This means that when an interrupt occurs (say a timer overflow) our program jumps to XYZ. Right?
I understand why we do this. We don't want an interrupt, during an interrupt.
My question is, shouldn't the DISABLE command go after the XYZ: label and the ENABLE COMMAND go before the RESUME command?
The way it is written in my sample, when the program jumps to XYZ: the DISABLE is not executed. Also, When we exit the interrupt code with RESUME, the program doesn't execute the ENABLE. Kinda defeats the purpose. No?
Thanx in advance.
Bookmarks