Shop OBEX P1 Docs P2 Docs Learn Events
DIRS for BS2P40?? — Parallax Forums

DIRS for BS2P40??

DonalbaneDonalbane Posts: 11
edited 2005-05-02 17:47 in BASIC Stamp
Is there a way to set the directions of all the pins (IN or OUT) in one place for the BS2P40? For the regular basic stamp, DIRS is a 16-bit number, but there are more than 16 I/O ports for the BS2P40. Is there an analogous variable to DIRS?

Thanks in advance,
Don
dtucker@arlut.utexas.edu

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-29 22:19
    Don,

    ·· You can only set the DIRS for one bank of pins at a time.· In between you must use the MAINIO, AUXIO or IOTERM commands to switch between them.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DonalbaneDonalbane Posts: 11
    edited 2005-04-29 22:57
    OK, I just read the manual on AUXIO and MAINIO.· I have a section of code I'm migrating from an older BS2 chip that looks like:

    SPI_CLOCK······· CON··· 03· ' P04 - Clock line for SPI comms
    POT_DOUT······· CON··· 01· ' X02 - Digital Pot Output
    Potval·· VAR· Byte

    Potval = 125

    SHIFTOUT POT_DOUT, SPI_CLOCK, MSBPOST, [noparse][[/noparse]Potval \8]

    How do I call the SHIFTOUT line which uses both ports from the MAINIO and the AUXIO side of the chip?


    Don
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-29 23:52
    Don,

    · If you connected the pins for a synchronous serial device to different I/O ports on the BS2P40, it's not going to work, since you can only access one group at a time.· You will need to keep pins for similar devices on the same group (MAIN/AUX).··In fact, what is happening here is that the commands are trying to access those pins on the same group.· Both 1 and 3.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 4/30/2005 12:00:23 AM GMT
  • DonalbaneDonalbane Posts: 11
    edited 2005-05-02 14:38
    OK, thanks Chris.· That's kind of what I was afraid of.··I have a board already laid out with the clock line coming off one of the MAINIO ports.··If I want to use digital I/O with the·clock on the AUXIO ports, do you think it would cause any problems to add another clock port on the AUXIO side and then solder that port to the same line that the MAINIO clock line is connected to?

    Don
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-05-02 15:40
    Don,

    ·· If you mean have the MAINIO and AUXIO pins connected together, I'm not sure that would be a good idea.· I suppose you could if you made sure the unused one was an input, but I certainly wouldn't recommend it.· It certainly isn't a conventional idea.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-05-02 17:47
    Make the bridge with 220 ohm resistor. That way if through some programming error both are made outputs in opposite states, they won't contend fatally. Other than that, it should be okay. Just leave the pin that is inactive configured as an input.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.