END is a reserved word and can't be used as a label.
The blue loop is GOSUBing back to itself. It should be GOTO.
And, it needs to turn off the CCP module before shifting any data.
Make sure the PAUSE 500 is NOT in the latching: subroutine anymore.
Code:BVar = 1023 blue: CCP1CON = 0 shiftout d2pin, c2pin,1 [funct\1,Rvar\10,Gvar\10,Bvar\10] gosub latch gosub BringUpPWM pause 100 Bvar = Bvar - 2 if bvar < 3 then goto BlueDone GOTO blue BlueDone:
Bookmarks