ok, simple little xmas lights project and i been at it for 2 weeks and it's not doing what it's supposed to...

it's a simple 3 led software simplified PWM.... system....

the first light 'sequence' is to fade from red into green then into blue then back to red... and the cycle repeats...

I'm using 18F4550's with intosc... PBP 2.60A
it brings up the red, then the green and the fades out the green and goes back to red... that's when i can get it not to power both green and red solidly at the same time...
it's powered from a single lipol cell...

Can someone take a look at my code and tell me if i've gone completely mad?
Thanks

Be aware, on this version i set the chip to use an external 20MHz resonator and the BOR is set wrong (corrected at programming)

Code:
@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L
@ __CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_ON_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_OFF_2L
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_32768_2H
@ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_ON_4L &  _ICPRT_OFF_4L & _XINST_ON_4L & _DEBUG_OFF_4L

Define  OSC				20						' Set clock speed

TRISB = %00000000
PORTB = %00000000

RED VAR PORTB.7
GREEN VAR PORTB.6
BLUE VAR PORTB.5
REDSCALE VAR WORD
GREENSCALE VAR WORD
BLUESCALE VAR WORD
Aloop VAR byte
Bloop VAR BYTE
DUTY var BYTE
clear
REDSCALE = 1
BLUESCALE = 1
GREENSCALE = 1
DUTY = 1

gosub powerupred
MAIN:
gosub powerupgreen
gosub powerdownred
gosub powerupblue
gosub powerdowngreen
gosub powerupred
gosub powerdownblue
GOTO MAIN

POWERUPRED:
for Aloop = 1 to DUTY
FOR Bloop = 1 to REDSCALE
HIGH RED
pause Aloop
LOW RED
pause (duty-Aloop)
NEXT Bloop
NEXT Aloop
HIGH RED
return

POWERDOWNRED:
for Aloop = 1 to duty
FOR Bloop = 1 to REDSCALE
HIGH RED
pause (duty-Aloop)
LOW RED
pause Aloop
NEXT Bloop
NEXT Aloop
return

POWERUPGREEN:
for Aloop = 1 to duty
FOR Bloop = 1 to GREENSCALE
HIGH GREEN
pause Aloop
LOW GREEN
pause (duty-Aloop)
NEXT Bloop
NEXT Aloop
HIGH GREEN
return

POWERDOWNGREEN:
for Aloop = 1 to duty
FOR Bloop = 1 to GREENSCALE
HIGH GREEN
pause (duty-Aloop)
LOW GREEN
pause Aloop
NEXT Bloop
NEXT Aloop
return

POWERUPBLUE:
for Aloop = 1 to duty
FOR Bloop = 1 to BLUESCALE
HIGH BLUE
pause Aloop
LOW BLUE
pause (duty-Aloop)
NEXT Bloop
NEXT Aloop
HIGH BLUE
return

POWERDOWNBLUE:
for Aloop = 1 to duty
FOR Bloop = 1 to BLUESCALE
HIGH BLUE
pause (duty-Aloop)
LOW BLUE
pause Aloop
NEXT Bloop
NEXT Aloop
return