BASIC stamp manual v2.2
IOTERM – BASIC Stamp Command Reference
Page 248 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
Stamp that all commands following it should affect the auxiliary I/O pins
(Port = 1). The following LOW command will set I/O pin 0 of the
auxiliary I/O pins (physical pin 21) low.
Note that the main I/O and auxiliary I/O pins are independent of each
other; the states of the main I/O pins remain unchanged while the
program affects the auxiliary I/O pins, and vice versa.
Other commands that affect I/O group access are AUXIO and MAINIO.
Demo Program (AUX_MAIN_TERM.bsp)
' AUX_MAIN_TERM.bsp
' This program demonstrates the use of the AUXIO, MAINIO and IOTERM
' commands to affect I/O pins in the auxiliary and main I/O groups.
' {$STAMP BS2p}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2E, BS2SX
#ERROR "Program requires BS2p40"
#CASE BS2P, BS2PE, BS2PX
DEBUG "Note: This program designed for the BS2p40.", CR
#ENDSELECT
port VAR Bit
Main:
DO
MAINIO ' Switch to main I/O pins
TOGGLE 0 ' Toggle state of I/O pin P0
PWM 1, 100, 40 ' Generate PWM on I/O pin P1
AUXIO ' Switch to auxiliary I/O pins
TOGGLE 0 ' Toggle state of I/O pin X0
PULSOUT 1, 1000 ' Generate a pulse on I/O pin X1
PWM 2, 100, 40 ' Generate PWM on I/O pin X2
IOTERM port ' Switch to main or aux I/Os
' -- depending on port
TOGGLE 3 ' Toggle state of I/O pin 3
' -- on main and aux, alternately
port = ~port ' Invert port
PAUSE 1000 ' 1 second delay
LOOP
END
MAIN I/O AND AUXILIARY I/O PINS ARE
INDEPENDENT AND UNAFFECTED BY
CHANGES IN THE OPPOSITE GROUP
.
2
p
NOTE: This example program will
tokenize with the 24-pin BS2p, BS2pe,
and BS2px but its effects can only be
seen on the BS2p40. This program
uses conditional compilation techniques;
see Chapter 3 for more information.