The little light bulb went off in my head this morning about using a flip flop to turn on or off a pin on portb.1. Ok, I thought I could push a momentary button one time on portb.0 and portb.1 would go high, pushing the button once more and releasing it, portb.1 would go low. Hmmm, sounds easy, so off to my keyboard:
flipflop VAR BYTE
flipflop=%00000000
loop:
IF portb.0 = 1 && flipflop.0 = 0 THEN
flipflop.0=1
portb.1=1
ENDIF
PAUSE 100
IF portb.0 = 1 && flipflop.0 = 0 THEN
flipflop.0=1
portb.1 = 0
ENDIF
IF portb.0 = 0 THEN 'With this the button would have to be release so it would
flipflop = flipflop ^ %00000001 'not continue to toggle
ENDIF
goto loop
Would this be the way to do this?
Thanks for your suggestions.
END
Bookmarks