Syntax
INTERRUPT
expression
Description
INTERRUPT will disable
interrupts if expression is 0. And it will enable interrupts if
expression is non-zero. The default case is to have interrupts
enabled.
Use this routine with caution, such as generating fixed
time signals, or doing synchronous input. Do NOT disable interrupts around
large sections of the program. Serial input will stop functioning and characters may be lost if interrupts are off for too
long.
Example
' read a synchronous byte from a device with ready on pin 0, clock pin 1 and data on pin 2
FUNCTION ReadBit
WHILE IN(1)=0 ' wait for
clock to go high
RETURN IN(2) AND 1
END
FUNCTION
...
WHILE IN(0) ' wait for ready signal
LOOP
INTERRUPT 0
BIT0 = ReadBit
BIT1 =
ReadBit
BIT2 = ReadBit
BIT3 = ReadBit
BIT4 = ReadBit
BIT5 =
ReadBit
BIT6 = ReadBit
BIT7 = ReadBit
INTERRUPT 1
VALUE = BIT0 + (BIT1<<1) + (BIT2<<2)+ (BIT3<<3)+ (BIT4<<4)+(BIT5<<5)+ (BIT6<<6)+ (BIT7<<7)
Differences from other BASICs
- no equivalent in Visual BASIC
- no equivalent in PBASIC
See also