Auxio and var
T Chap
Posts: 4,223
I am having trouble making auxio and var work when using mainio but to control auxio output. Here is an example:
MAINIO
INPUT 1
BUT1 var in1
AUXIO
output 1
AUXTEST_LED var OUT5
MAIN:
IF BUT1 = 1 THEN
AUXTEST_LED = 1
ENDIF
GOTO MAIN
Things work fine if I do this:
main:
auxio
main:
auxtest_led = 1
pause 500
goto main
BUT, unless MAINIO or AUXIO preceeds their respective commands, they don't work.
Why can't you assign a varable to an auxio output, and then to a mainio input and have them talk to each other using their alias?
MAINIO
INPUT 1
BUT1 var in1
AUXIO
output 1
AUXTEST_LED var OUT5
MAIN:
IF BUT1 = 1 THEN
AUXTEST_LED = 1
ENDIF
GOTO MAIN
Things work fine if I do this:
main:
auxio
main:
auxtest_led = 1
pause 500
goto main
BUT, unless MAINIO or AUXIO preceeds their respective commands, they don't work.
Why can't you assign a varable to an auxio output, and then to a mainio input and have them talk to each other using their alias?
Comments
Typically you would set up pins as follows:
Notice no MAINIO or AUXIO commands?· You would use those in the code for example:
The same goes for variables...You cna't lock them to a bank.· Whatever bank is active gets assigned based on its pin number or port group.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
ie IF (LOCKBUT_M = 1) AND (LOCK_LATCH_M = 0) THEN TURN_LOCK_LATCH_M_ON
whereas LOCKBUT_M = 1 is on mainio and LOCK_LATCH_M = 0 is on auxio
Thanks a lot Chris!
Thanks
CHECK_LOCKBUT_M:
MAINIO
IF LOCKBUT_M = 0 THEN RETURN
IF (LOCKBUT_M = 1) THEN CHECK_Lock_Latch_M
CHECK_Lock_Latch_M:
AUXIO
IF lock_latch_m = 0 THEN TURN_LOCK_LATCH_M_ON
IF lock_latch_m = 1 THEN TURN_LOCK_LATCH_M_OFF
TURN_LOCK_LATCH_M_ON:
AUXIO
LOCK_LATCH_M = 1
GOTO HOLD_FOR_LOCKBUT_M_RELEASE
TURN_LOCK_LATCH_M_OFF:
AUXIO
LOCK_LATCH_M = 0
GOTO HOLD_FOR_LOCKBUT_M_RELEASE
HOLD_FOR_LOCKBUT_M_RELEASE:
MAINIO
IF LOCKBUT_M = 1 THEN HOLD_FOR_LOCKBUT_M_RELEASE
IF LOCKBUT_M = 0 THEN RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
thanks