Shop OBEX P1 Docs P2 Docs Learn Events
switching between mainio and auxio — Parallax Forums

switching between mainio and auxio

ArchiverArchiver Posts: 46,084
edited 2004-02-27 22:33 in General Discussion
I've got a BS2p40, and during my program, I have to switch back and
forth between the MAINIO pins and the AUXIO pins. To do this, I just
insert a line saying "MAINIO" or "AUXIO" before each change.

Is there an easier way to do this? For instance, if I'm looking for
an input on the MAINIO pins, and when I get an input, I have to light
a LED that's connected to the AUXIO pins, and then go back to looking
for an input on the MAINIO pins.

Any suggestions? Don't say I should move everything to one side or
the other because I've got 30 I/O's right now, and I've arranged them
as best I can.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-02-27 22:23
    You could "virtualize" your outputs with a subroutine. Like this:

    Set_Output:
    IOTERM outPin / 16 ' select io bank
    IF (outLvl = 1) THEN ' 1 = high
    HIGH (outPin // 16)
    ELSE ' 0 = low
    LOW (outPin // 16)
    ENDIF
    RETURN

    Of course, now you'll need a byte variable for your pin and a bit
    variable for its new state.

    -- Jon Williams
    -- Parallax


    Original Message
    From: andy_watson5 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=8be_W8Fw3gwx1ENWuofcQ33ubREx9-0D5uMYmNwfppd6bEdC16MJl-vfDngKVLINXO5OD8zqwrbOOg]andywatson@m...[/url
    Sent: Friday, February 27, 2004 3:01 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] switching between mainio and auxio


    I've got a BS2p40, and during my program, I have to switch back and
    forth between the MAINIO pins and the AUXIO pins. To do this, I just
    insert a line saying "MAINIO" or "AUXIO" before each change.

    Is there an easier way to do this? For instance, if I'm looking for
    an input on the MAINIO pins, and when I get an input, I have to light
    a LED that's connected to the AUXIO pins, and then go back to looking
    for an input on the MAINIO pins.

    Any suggestions? Don't say I should move everything to one side or
    the other because I've got 30 I/O's right now, and I've arranged them
    as best I can.
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-27 22:33
    Switching between MAINIO and AUXIO is very fast.

    There is the POLLOUT command, which allows you to link the state of
    an output pin to the state of an input pin. That works automatically
    in the background. But it is quite limited when you have more than
    one output depending on more than one input.

    I don't know of any easy way, except to group functions so that the
    ones that are used together are on one side of the other. (So I did
    mention it!) It would not make sense for example to have the pins
    for an LCD cross the pin groups boundary.



    >I've got a BS2p40, and during my program, I have to switch back and
    >forth between the MAINIO pins and the AUXIO pins. To do this, I just
    >insert a line saying "MAINIO" or "AUXIO" before each change.
    >
    >Is there an easier way to do this? For instance, if I'm looking for
    >an input on the MAINIO pins, and when I get an input, I have to light
    >a LED that's connected to the AUXIO pins, and then go back to looking
    >for an input on the MAINIO pins.
    >
    >Any suggestions? Don't say I should move everything to one side or
    >the other because I've got 30 I/O's right now, and I've arranged them
    >as best I can.
Sign In or Register to comment.