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

mainio and auxio

Bruce KingBruce King Posts: 12
edited 2010-08-02 02:57 in BASIC Stamp
I can't find any details on whether or not you can have·a statement that uses labels on both the main and aux sections on a BS2P40.

What if you have this:

IF wellpump AND NOT wellpumptrip AND NOT (enable2 OR enable3 OR enable4) AND total = 0 THEN enable = 1

where wellpump is an input on the mainio section and wellpumptrip is an output on the auxio section.

Any way to make this work?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-02 02:43
    No

    Either the MainIO or the AuxIO pins are accessible at any one time, not both. Although it only takes a single statement (MAINIO or AUXIO) to switch, there's no way to execute that in the middle of a statement.

    The easiest way to accomplish what you want would be to use a 1-bit variable to hold the value of wellpumptrip like:

    auxio
    holdWellpumptrip = wellpumptrip
    mainio
    if wellpump and not holdWellpumptrip and not (enable2 or enable3 or enable4) and total = 0 then enable = 1

    Alternatively, you could have nested IF statements like

    auxio
    if not wellpumptrip then
    mainio
    if wellpump and not (enable2 or enable3 or enable4) and total = 0 then enable = 1
    endif

    You could even do the above in one line with

    auxio : if not wellpumptrip then : mainio : if wellpump and not (enable2 or enable3 or enable4) and total = 0 then enable = 1
  • Bruce KingBruce King Posts: 12
    edited 2010-08-02 02:57
    thanks for the quick response!

    I might just move it to the mainio and make it easier to deal with. I have a 4 yr old over complicated alarm that I sort of lost interest in and am now adding in some new stuff on the same board and its been a real chore to get back on track here.

    What type of projects do you like to work with Mike?
Sign In or Register to comment.