AUXIO

BS2p icon (BS2p40)

AUXIO / MAINIO / IOTERM Example

 

 

 

Syntax: AUXIO

Function

Switch from control of main I/O pins

Quick Facts

  BS2p, BS2pe, and BS2px
I/O Pin IDs 0 - 15 (just like main I/O, but after AUXIO command, all references affect physical pins 21 - 36).
Special Notes

Command is accepted by the 24-pin BS2p, BS2pe, and BS2px, but only the 40-pin BS2p40 gives access to the auxiliary I/O pins.

Related Commands

MAINIO, IOTERM

Explanation

The BS2p, BS2pe, and BS2px is available as a 24-pin module that is 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 extra, or auxiliary, I/O pins can be accessed in the same manner as the main I/O pins (by using the IDs 0 to 15) but only after issuing an AUXIO or IOTERM 1 command. The AUXIO command causes the BASIC Stamp to affect the auxiliary I/O pins instead of the main I/O pins in all further code until the MAINIO or IOTERM 0 command is reached, or the BASIC Stamp is reset or power-cycled. AUXIO is also used when setting the DIRS register for auxiliary IO pins on the BS2p40.

The following example illustrates this:

Main:
  HIGH 0
  AUXIO
  LOW 0

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 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 (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.

Reducing Power Consumption

When the BASIC Stamp is reset all RAM variables, including DIRS and OUTS are cleared to zero. This goes for main and auxiliary pins. On the BS2p24, BS2pe, and BS2px the auxiliary pins from the interpreter chip are not connected to physical IO pins on the BASIC Stamp. While not connected to anything, these pins do have pull-ups activated, effectively connecting them to Vdd. After reset, reading the auxiliary pins from a BS2p24, BS2pe, or BS2px will return all 1s. For lowest possible current consumption where required, you may set the BS2p24, BS2pe, and BS2px auxiliary pins as output low.

Setup:
  AUXIO                                 ' select AUXIO pins
  OUTS = $0000                          ' force outputs low
  DIRS = $FFFF                          ' make (unconnected) pins outputs
  MAINIO                                ' back to MAINIO group

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012