Yes, the manual is a bit vague. But if we take a look at the macro's themself it should be a little clearer.
These are from the PBPPIC14.mac file.
Code:
;****************************************************************
;* RESUME? : Macro - Resume *
;* *
;* Input : None *
;* Output : None *
;* *
;* Notes : *
;****************************************************************
RESUME? macro
RST?RP
retfie
endm
endmod
;****************************************************************
;* RESUME?L : Macro - Resume Label *
;* *
;* Input : Label *
;* Output : None *
;* *
;* Notes : *
;****************************************************************
RESUME?L macro Label
bsf INTCON, GIE
L?GOTO Label
endm
endmod
With only the RESUME it does a retfie (Return from Interrupt) which causes the hardware to turn GIE back on and pops the last address off the stack to return to.
But, if you include a label with the resume, all it does is set the GIE bit manually, then GOTO's the label. At this point, the address from the interrupt is still on the stack. Once the Subroutine has finished and does a RETURN. It will return to the point where the interrupt first happened.
If the subroutine doesn't do a RETURN, the stack keeps building up.
Also, that subroutine should be enclosed in DISABLE/ENABLE statments to keep it from being interrupted before it returns.
If you're OK with the idea of the stack wrapping around and Discarding all previous gosubs after an interrupt, then it'll still work that way on a 16F. But don't try it with an 18F.
HTH,
Darrel
Bookmarks