mainio and auxio
Bruce King
Posts: 12
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?
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
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
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?