I've written a simple program to pulse a LED on GPIO.0 of a 12F675, which worked fine. However I didn't save the file, and so I started from scratch again this morning.. but I'm experiencing some strange behaviour.

This is the main body of the code:

Code:
led var GPIO.0

i var byte

up:
For i = 1 to 254                                                  
Pwm GPIO.0,i,1
if i = 254 then goto down
next i

down:
for i = 254 to 1 step-1
pwm GPIO.0,i,1
if i = 1 then goto main
next i
As you can see its a simple FOR/NEXT loop, that, should i reach a set value, goto either up or down section.

However when programmed, the LED ramps up in brightness but then fails to ramp down. I've tried remming out the up section and all that happens is that the LED flashes fast (as if i is not reducing by the step-1 command)

Code:
;up:
For i = 255 to 1 step-1                                                 
Pwm GPIO.0,i,1
;if i = 254 then goto down
next i

;down:
;for i = 254 to 1 step-1
;pwm GPIO.0,i,1
;if i = 1 then goto main
;next i
Its as if the PWM command or the step-1 statement is not being observed. And what's bugging me is I know it can be done as it worked before (the chip is now in cornwall so I can't read back the HEX !)

Comments anyone please !