Shop OBEX P1 Docs P2 Docs Learn Events
aux i/o pins on BS2p40 — Parallax Forums

aux i/o pins on BS2p40

dwbowendwbowen Posts: 30
edited 2008-11-08 00:05 in BASIC Stamp
howdy!

can someone direct me to instructions on how to access the aux pins on a BS2p40?

for example if I want to read a switch on pin 0 I type:

debug home, ? IN0

but what if I want to read a switch on the pin labeled as X0 on the BS2p40SchematicRevD downloaded from parallax?

i tried both:

debug home, ? INXO

and:

debug home, ? IN21


Im sure its something simple Im missing

thanks

Comments

  • ZootZoot Posts: 2,227
    edited 2008-11-08 00:05
    Seriously, read the Pbasic Manual where all this is explained in extreme detail.

    But since you asked, pins on the AUXIO side are accessed *as if* they were also numbered 0-15, but you must "choose" which side you are working with at any given time using the AUXIO and MAINIO commands (IOTERM is cool also for more programmed switches).

    i.e.

    ' mainio side pins
    Sonar PIN 0
    IRled  PIN 1
    
    ' auxio side pins
    MotorLeft PIN 0 ' i.e. pin 16
    MoroLeft PIN 1 ' i.e. pin 17
    'etc
    
    Main:
    
       MAINIO  ' working with pins on main side, i.e. 0-15
       HIGH Sonar 
       PULSIN Sonar, 1, temp
       FREQOUT IRled, 100, 100 'etc
    
       AUXIO  ' now i'm working with aux pins, i.e. 16-31, but you *use* pins 0-15 in commands:
       HIGH MotorLeft
       LOW MotorRight
    
    GOTO Main
    
    



    One note, that in my experience, while slot switches (i.e. RUN x) are fast, pin bank switches are *relatively* slow -- so if you pile them up you will see precious milliseconds start to vaporize. I try to set up my programs so that all the MAINIO work gets done, then all the AUXIO work, so that there are few switches back and forth.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.