#include start org 0x00 red equ 0x08 ;defining the memory locations of the variables green equ 0x09 blue equ 0x0A timer equ 0x0B movlw 0xF8 TRIS GPIO movlw 0x00 ;set red value movwf red movlw 0x00 ;set green value movwf green movlw 0x00 ;set blue value movwf blue loop call update bsf GPIO,0 ;turn on LEDs bsf GPIO,1 bsf GPIO,2 movlw .0 ;set loop time to 0 movwf timer loop2 movfw timer subwf red,0 ;red-time=w btfsc 03h,2 ;if w=0 don't skip next step bcf GPIO,0 ;turn off red LED movfw timer subwf green,0 btfsc 03h,2 bcf GPIO,1 movfw timer subwf blue,0 btfsc 03h,2 bcf GPIO,2 movlw 0x01 addwf timer,1 btfsc 03h,0 ;time=256? goto loop ;no, goto loop2 ;yes update movlw 0x01 ;set amout to increment coulour values by addwf red,1 btfss 03h,0 return addwf green,1 btfss 03h,0 return addwf blue,1 Return end