MAINIO - BASIC Stamp Command Reference
Page 190 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
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 IOTERM.
Demo Program (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} 'STAMP directive (specifies a BS2p)
Port VAR BIT
Loop:
MAINIO 'Switch to main I/O pins
TOGGLE 0 'Toggle state of I/O pin 0 (physical pin 5)
PWM 1, 100, 40 'Generate PWM on I/O pin 1 (physical pin 6)
AUXIO 'Switch to auxiliary I/O pins
TOGGLE 0 'Toggle state of I/O pin 0 (physical pin 21)
PULSOUT 1, 1000 'Generate a pulse on I/O pin 1 (physical pin 22)
PWM 2, 100, 40 'Generate PWM on I/O pin 2 (physical pin 23)
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 (switch between 0 and 1)
PAUSE 1000
GOTO Loop
2
NOTE: This is written for the BS2p
but its effects can only be seen on
the 40-pin version: the BS2p40.
M
AIN I/O AND AUXILIARY I/O PINS ARE
INDEPENDENT AND UNAFFECTED BY
CHANGES IN THE OPPOSITE GROUP.