Hi, Gert
And what about showing us some of your lines ????
Alain
Hi, Gert
And what about showing us some of your lines ????
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi Gert,
I think this is what you may be after:
Regards,Code:' ---------- [ I/O Definition ] ---------- TRISC = %00000001 ' Set PORTC (0-2 input) rest Outputs PORTB = 0 ' ---------- [ System Inputs ] ---------- Switch Var PORTC.0 ' Momentary Switch on PORTC.0 ' ---------- [ System Outputs ] ---------- RedLED VAR PORTB.1 ' All LEDs connected ' between RC pins and ' ground via resistor Main: If Switch=1 Then ' If button is pressed: Toggle RedLED ' Toggle the LED loop: If Switch=1 Then Goto loop ' Wait until the button is released Endif Goto Main
Steve
Is this wht your after try it and lets us know
it uses 1 button to turn led on/off
led1_status var bit
button1 var portb.0
led1 var portb.1
main:
if button1 = 1 then ' if the button is pressed
if led1_status = 1 then ' if its last state was 1
led1_status = 0 ' make it 0
low led1
pause 500 'debounce
else
led1_status = 1 ' the last state was a 0 so now make it a 1
high led1
pause 500 'debounce
endif
endif
chuck
I see that i missed the goto main of at the end
i see that Tissy replied beofre me that must have been while i went and add a coffie but at least you have got to ways of doing it now
chuck
Hi,
Thanks to Tissy and Chuck for your examples.
I can conclude that you don't use the BUTTON command when you "read" a switch.
I just thought that it was possible to set up all the parameters with the BUTTON command.
But I think that your examples teach me that using IF - THEN and GOTO or WHILE - WEND gives me much better possibilities.
Gert
*Let's do it*
Bookmarks