dfort
- 5th March 2008, 19:34
I am trying to blink 2 LEDS, like the railroad cross signal, but can't get it to work on a 12f629. I need to use the codes defined at below, which will make reassigning variables for other purposes easy. When I run this, only the "LEDBottom" blinks, which is that last one that the code executes. LEDTop stays on permanently. Can someone help?
Here's what I have:
'set input/output pins
TRISIO = %111100 '1=input, 0=output
'define variables
LEDTop var GPIO.0
LEDBottom var GPIO.1
TurnOn var byte
TurnOff var byte
'set variables
turnon = %0
turnoff = %1
'start of program
LEDtop = turnoff
Ledbottom = turnoff
InputLoop:
ledtop = turnon
ledbottom = turnoff
pause 500
ledtop = turnoff
ledbottom = turnon
pause 500
goto inputloop
P.S. I don't want to use this:
InputLoop:
GPIO=%000001
pause 500
GPIO=%000010
pause 500
GOTO InputLoop
Here's what I have:
'set input/output pins
TRISIO = %111100 '1=input, 0=output
'define variables
LEDTop var GPIO.0
LEDBottom var GPIO.1
TurnOn var byte
TurnOff var byte
'set variables
turnon = %0
turnoff = %1
'start of program
LEDtop = turnoff
Ledbottom = turnoff
InputLoop:
ledtop = turnon
ledbottom = turnoff
pause 500
ledtop = turnoff
ledbottom = turnon
pause 500
goto inputloop
P.S. I don't want to use this:
InputLoop:
GPIO=%000001
pause 500
GPIO=%000010
pause 500
GOTO InputLoop