BASIC stamp manual v2.2

AUXIO - BASIC Stamp Command Reference
Page 130 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Here is a simple AUXIO example:
HIGH 0 ' make P0 high
AUXIO ' select 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
(P0, physical pin 5) high. Afterward, the AUXIO command tells the
BASIC Stamp that all commands following it should affect the auxiliary
I/O pins. The following LOW command will set I/O pin 0 of the auxiliary
I/O pins (X0, 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 MAINIO and IOTERM.
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
A
SIMPLE AUXIO EXAMPLE.
M
AIN 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.