Multiple inputs
K. Reichman
Posts: 9
How can modify these code to reat eight inputs ??? This code is an example by Parallax.
'
BtnBus VAR INA
'
[noparse][[/noparse] Variables ]
btns VAR Nib
idx VAR Nib
'
[noparse][[/noparse] Program Code ]
Main:
DO
GOSUB Get_Buttons
DEBUG HOME,
"Inputs = ", IBIN4 btns
PAUSE 50
LOOP
'
[noparse][[/noparse] Subroutines ]
Get_Buttons:
btns = %1111
FOR idx = 1 TO 5
btns = btns & ~BtnBus
PAUSE 5
NEXT
RETURN
Tx
'
BtnBus VAR INA
'
[noparse][[/noparse] Variables ]
btns VAR Nib
idx VAR Nib
'
[noparse][[/noparse] Program Code ]
Main:
DO
GOSUB Get_Buttons
DEBUG HOME,
"Inputs = ", IBIN4 btns
PAUSE 50
LOOP
'
[noparse][[/noparse] Subroutines ]
Get_Buttons:
btns = %1111
FOR idx = 1 TO 5
btns = btns & ~BtnBus
PAUSE 5
NEXT
RETURN
Tx
Comments
BtnBus··· VAR··· INL
'
[noparse][[/noparse] Variables ]
btns····· VAR····Byte
idx······ VAR··· Nib
'
[noparse][[/noparse] Program Code ]
Main:
· DO
··· GOSUB Get_Buttons
··· DEBUG HOME,
········· "Inputs = ", IBIN8 btns
··· PAUSE 50
· LOOP
'
[noparse][[/noparse] Subroutines ]
Get_Buttons:
· btns = %11111111
··· FOR idx = 1 TO 5
····· btns = btns & ~BtnBus
····· PAUSE 5
··· NEXT
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax