The Result:
when porta.0 is triggered, portc.0 turns on 5 times
when porta.1 is triggered, portc.0 turns on 1 and then portc.1 turns on 4 times
Questions:
1. why is it doing that? I just want it to light up once.
what do the trigger??? push button, jumper ? The reason is because you have to wait untill the trigger is release. so the following will resolve the problem.
Code:
osccon = %01100000
ansel = 0
cmcon0 = %00000111
trisa = %11111111
trisc = %00000000
portc = %00000000
left var porta.0
right var porta.1
loop:
if left then
portc.0 = 1
While left 'wait until left is release to 0V
Wend
pause 2500
portc.0 = 0
porta.0 = 0
endif
if right then
portc.1 = 1
While right 'wait untill right is release to 0V
Wend
pause 2500
portc.1 = 0
porta.1 = 0
endif
portc.3 = 1
pause 120
portc.3 = 0
pause 120
goto loop
2. is there a way I can have two ports light up at the same time? (i.e. porta.0 and porta.2 turn on at the same time
Sure...
let's say you want to turn Porta.0 and Porta.2 at the same time
PORTA=%00000101
that's it
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks