Page 339 of 346 Start Back Next End ZBasic System Library 327 ZBasic Microcontrollers Note that a task awaiting an interrupt will exhibit some latency between the occurence of the interrupt and when the waiting task begins execution. The latency depends on a number of factors including the specific instruction being executed at the time of the interrupt and the number and frequency of system interrupts that need to be handled. Instructions that may take a long time to execute such as OutputCapture(), ShiftIn(), ShiftOut(), X10Cmd(), etc. will introduce more latency than simple instructions like assigning a value to a variable. Examples Call WaitForInterrupt(zxPinChange) Call WaitForInterrupt(zxPinRisingEdge, WaitInt2) Call WaitForInterrupt(&H40, WaitPinChangeA) ' await a change on Port A, bit 6 Resource Usage Only one task can be awaiting each interrupt at any particular time. If a task is already awaiting the specified interrupt, another call to WaitForInterrupt() for that same interrupt will return immediately. Also, on the ZX-24 the interrupt pins are common with I/O pins as shown in the table below. This means that you should set the corresponding pin to be an input (either tri-state or pull-up) when you want to use WaitForInterrupt(). Note, however, that if the pin is an output and a task is awaiting an interrupt, a transition on the corresponding output can generate the interrupt for the waiting task. This may be of use in special situations as a “software interrupt”. Interrupt and I/O Pin Sharing for ZX-24, ZX-24a, ZX-24p, ZX-24n, ZX-24r, ZX-24s Interrupt Port/Bit Pin 0 Port C, Bit 6 6 1 Port C, Bit 1 11 2 Port A, Bit 2 18 Compatibility The second parameter is not supported in BasicX compatibility mode. The built-in constant zxPinChange is not available in BasicX. It is not known if the capability is supported or not.