PDA

View Full Version : Blinky not working with TOGGLE



AndrewC
- 21st November 2008, 20:11
Now I'm stumped. My usual simple BLINKY is:

[code]
LED VAR PORTB.0
Loop:
Pause 1000
toggle LED
Goto Loop
[\code]

Usually works fine but seemingly not on a 16F777. the LED just stays on. This does work:

[code]
LED VAR PORTB.0
LOOP:
LED = 1
pause 1000
LED = 0
pause 1000
goto LOOP
[\code]

So what no doubt blindingly obvious simple thing am I overlooking ?

Andrew

mehmetOzdemir
- 21st November 2008, 22:07
Now I'm stumped. My usual simple BLINKY is:

[code]
LED VAR PORTB.0
Loop:
Pause 1000
toggle LED
Goto Loop
[\code]

Usually works fine but seemingly not on a 16F777. the LED just stays on. This does work:

[code]
LED VAR PORTB.0
LOOP:
LED = 1
pause 1000
LED = 0
pause 1000
goto LOOP
[\code]

So what no doubt blindingly obvious simple thing am I overlooking ?

Andrew

i usually work with " xor " instead of toggle command.

for example ;
main :

led = led xor 1 ; working better than toggle
pause 100

goto main

mister_e
- 21st November 2008, 23:07
it's not going to work with XOR... ^1 would work.

AndrewC, post your Whole code, sure enough you have something else on the top of it. As usual check for multiplexed stuff on the offending I/O.

AndrewC
- 22nd November 2008, 08:45
Thanks for the replies - turns out it was a naff PIC. After some more tinkering last night I started getting programming errors. Tried an 877A to check my programmer, no problems. Pulled a new 777 and voila, success. Phew - just goes to prove - don't assume anything !