Shop OBEX P1 Docs P2 Docs Learn Events
BS2p40 commands — Parallax Forums

BS2p40 commands

ZimZim Posts: 1
edited 2006-02-21 17:49 in BASIC Stamp
Can somebody tell me how the OUTL and OUTH commands will work on a BS2p40 IC? On the BS2-24 OUTL references to output 0-7 (low byte) and OUTH to 8-15 (high byte). Since the BS2p40 has 32 in/out pins, how can I command pins 16-31 in this way?

Also I don't get what the difference is between main I/O and aux I/O. Are these not completely interchangeable?

Thanks for your help.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-21 16:47
    In order to keep the architecture consistent, the 32 I/O pins are split into two groups: MAINIO (lower group, 0 - 15) and AUXIO (upper group, 16 - 31). You can use OUTL and OUTH with either group, you just have to set the group first. If, for example, you wanted to write eight bits to A0-A7 you need to add AUXIO before your code:

    · AUXIO
    · DIRL = %11111111··· ' make pins 16 - 23 outputs
    · OUTL = %11001100··· ' update pins 16 - 23

    Now keep in mind that every I/O operation at this point is directed to the AUXIO group. If you want to switch back to the lower group you can do that with MAINIO.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-02-21 16:56
    And watch carefully. You will find that one of the biggest sources of potential bugs in BS2p-40 programming is leaving your I/O set on the wrong bank!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-21 17:49
    One of the other potential problems I have seen is a few people have tried to use a pin from MAINIO and a pin from AUXIO to control an SPI device, which cannot be done.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.