![]() ZBasic System Library
114
ZBasic Microcontrollers
Type
Subroutine
Invocation
EnableInt(flag)
Parameter
Method
Type
Description
flag
ByVal
Byte
The value controlling re-enabling of interrupts.
Discussion
This routine conditionally re-enables interrupts depending on the value of the flag parameter. If the
most significant bit of the flag parameter is a 1, interrupts will be re-enabled. Otherwise, the state of the
interrupt enabling will not change. Passing the value returned from DisableInt() implements proper
nesting of DisableInt() and EnableInt() calls so they are most often used in pairs as shown in the example
below.
Note
The Atomic block construct (described in the ZBasic Language Reference Manual) is the preferred
method for implementing atomic access.
Example
Dim iflag as Byte
iflag = DisableInt()
' place code here that must not be interrupted
Call EnableInt(iflag)
See Also
|