BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – IOTERM
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 247
IOTERM
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
IOTERM Port
Function
Switch control to main I/O pins or auxiliary I/O pins (on the BS2p40 only)
depending on state of Port.
• Port is a variable/constant/expression (0 – 1) that specifies which
I/O port to use.
Quick Facts
Table 5.42: IOTERM Quick Facts.
BS2p, BS2pe, and BS2px
Values for Port
0 = switch to main I/O group, 1 = switch to auxiliary I/O group.
I/O pin IDs
0 – 15 (after IOTERM command, all references affect physical pins 5 –
20 or 21 – 36 depending on state of Port).
Special Notes
Both the BS2p and BS2pe 24-pin modules accept this command,
however, only the BS2p40 gives access to the auxiliary I/O pins.
Related
Commands
AUXIO and MAINIO
Explanation
The BS2p, BS2pe and BS2px are available as 24-pin modules that are pin
compatible with the BS2, BS2e and BS2sx. Also available is a 40-pin
module called the BS2p40, with an additional 16 I/O pins (for a total of
32). The BS2p40's I/O pins are organized into two groups, called main
and auxiliary. The I/O pins in each group can be accessed in the same
manner (by referencing I/O pins 0 – 15) but access is only possible within
one group at a time. The IOTERM command causes the BASIC Stamp to
affect either the main or auxiliary I/O pins in all further code until the
MAINIO, AUXIO or another IOTERM command is reached, or the BASIC
Stamp is reset or power-cycled. The value of Port determines which group
of I/O pins will be referenced. Using 0 for Port will switch to the main
I/O group and using 1 for Port will switch to the auxiliary group.
The following example illustrates this:
HIGH 0 ' make P0 high
IOTERM 1 ' Port = 1, so switch to auxiliary pins
LOW 0 ' make X0 low
The first line of the above example will set I/O pin 0 of the main I/O pins
(physical pin 5) high. Afterward, the IOTERM command tells the BASIC
A SIMPLE IOTERM EXAMPLE.