With regard to a Button selecting a input... your original example used PortC.4 for the button, so we'll carry on using that...
Button is connected between PortC.4 and 0v (Vss). A pull-up Resistor (10K) is connected between PortC.4 and +5v (Vdd).
PushButton var PortC.4
When button is pressed, the status of PushButton will be zero (Low), when button is released, the status will be 1 (High).
We'll also use a variable...
ButtonCounter var Byte
We will increment this variable each time button is pressed, and depending on the state of the variable, we will display one of your three inputs...
ButtonCounter=0
LCDOut $FE,1
' initially clear screen ready for display
Loop:
If PushButton=0 then
' Button has been pressed
LCDOut $FE,1
' Clear screen indicating to user that Button has been pressed
While PushButton=0:Wend
' Wait for button to be released
ButtonCounter=ButtonCounter+1
If ButtonCounter=>3 then ButtonCounter=0
' ButtonCounter only counts 0,1 or 2 then starts over again
endif
If ButtonCounter=0 then Gosub DisplayFirstADC
If ButtonCounter=1 then Gosub DisplaySecondADC
If ButtonCounter=2 then Gosub DisplayThirdADC
goto Loop
Have fun...
Melanie
Bookmarks