Alain, thank for the reply, but that still has the same effect, ie the LED ramps up in brightness, but doesn't ramp down.

Steve,
I never said my coding was tidy

However isn't

Code:
Main:
for i = 1 to 254                                             
    Pwm GPIO.0,i,1
    if i=253 then 
        i=254
        GetOut=1
        endif
   next i

if Getout then DoSomething
The same thing as

Code:
Main:
for i = 1 to 254                                             
Pwm GPIO.0,i,1
if i=253 then t=1
if t=1 then goto down
next i
in a round about way ? where the condition is replaced with t in my case ?

The thing that is also bugging me if that whilst the loop to increase the brightness works, the one to decrease it doesn't ???

Let me go away and try Steve's suggestion and see if I get any further.

Thanks as always for your inputs