Disable/Enable in Interrupts
If I have a group of Subroutines on top of my program and don't want these to be interrupted, can only one Disable on top and Enable on bottom be enough? Or every sub must have their own pair?
Is this correct:
On Interrupt Goto myint
Disable
Sub1
Return
Sub2
Return
Enable
Disable
myint:
Resume
Enable
main:
'my main loop with interrupts enabled
End
Thanks, Ioannis
Disable/Enable in Interrupts
Thanks for the reply.
The PIC is 16F877 and interrupts are coming from the UART module.
My concern is if the disable directive needs to be inserted in every subroutine. Logicaly not as it is directive and covers all the block of commands until it finds the Enable pair.
Ioannis
Re: Disable/Enable in Interrupts
This would also work but I think it would cause problems for you. For example;
if you call sub2 before calling sub1, then interrupts wont be disabled
if you call sub1 and return to main, then again interrupts wont be enabled until you call sub 2
So my suggestion is to disable - enable interrupts on each subroutine individually.
Re: Disable/Enable in Interrupts
Thanks, although back from the dead!
:)
Ioannis