Note: This program was written for the BS2p but can also run on the BS2pe or BS2px with a change of the $STAMP directive, however, its effects can only be seen on the BS2p40.
' 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 P0
PULSOUT 1, 1000 ' Generate a pulse on I/O pin P1
PWM 2, 100, 40 ' Generate PWM on I/O pin P2
IOTERM port ' Switch to main or aux I/Os
' -- depending on port
TOGGLE 3 ' Toggle state of I/O pin P3
' -- on main and aux, alternately
port = ~port ' Invert port
PAUSE 1000 ' 1 second delay
LOOP
END
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.
8/8/2012