ZBasic System Library
A value specifying what action will trigger the interrupt. See the
A designator for the interrupt to await (see discussion below).
This routine allows a task to suspend itself and wait for an interrupt. The particular interrupt awaited is
controlled by the intNum designator in combination with the mode value. There are three general
sources of interrupts that can be awaited: external interrupts, pin change interrupts and analog
External Interrupts 0-7 (ATtiny and ATmega targets)
A task may await an external interrupt by specifying the value 0 through 7 (corresponding to external
interrupt INT0 to INT7, respectively) for the intNum parameter. Not all target devices support the full
range of external interrupts. See the Resource Usage sub-section External Interrupts for information on
the available external interrupts for each target device along with the corresponding intNum value and
the interrupt input pin for each. The allowable values for the mode parameter and their respective
meanings are given in the table below.
Hardware Interrupt Mode Values
A low level on the interrupt pin.
Any logic level change on the interrupt pin.
A high to low transition on the interrupt pin.
A low to high transition on the interrupt pin.
All other values are reserved for future use. For compatibility with BasicX, there are similarly named built-
in constants that begin with the prefix bx instead of zx except that there is no equivalent for
zxPinChange. Additionally, for all of the targets in the table below, Interrupt 2 is not capable of the first
two trigger modes; it can only be triggered on a rising edge or a falling edge.
Target Devices with Limited Functionality on INT2
The built-in constants WaitInt0 through WaitInt7 may be used to specify the intNum parameter. If
no intNum parameter is given, Interrupt 1 is assumed (for compatibility with BasicX). This is equivalent
to using WaitForInterrupt(mode, 1).
Pin Change Interrupts (ATtiny and ATmega targets)
For most ATtiny and ATmega target devices, a task may await a state change on one or more pins of one
or more I/O ports. This mode is selected by specifying a special value for the intNum parameter that
indicates the port(s) and the mode parameter contains a bit mask indicating the bits of interest. For