Thank for the 'Hint', this is what i have come up with so far. I think i am along the right lines, but when you hit the button, it continously dims to OFF and there it stays. Am i on the right lines, before i go off on a tangent ?? Can you suggest anymore hints??

Heres what i have:

Code:
TRISB = %10000001   ' Set PORTB (0)INPUT (1-5)OUTPUTS
CMCON = 7 

SecSwitch   VAR PORTA.5
Red         VAR PORTB.1

Bright      VAR Byte
storedloop  VAR Byte

flag VAR Byte

bright = 254
flag = 0
Low red

Main:
    If secswitch = 0 then gosub pwmroutine
Goto Main


PWMRoutine:
     While (Bright !=255) and (flag = 0)
          PWM red,Bright,5 
          bright = bright - 1
     Wend
     While (bright !=0) and (flag = 1)
          PWM red,Bright,5
          bright=bright + 1
     Wend
Return

Flash:
For storedloop = 1 to 3
        High red
        Pause 100
        Low red
        Pause 100
Next storedloop
Return
Cheers,

Steve