; --- Rainbow12.asm ; NeoPixel demonstration program ; NeoPixel data out = RD0 #include ; --- Variables --- CNT0 EQU 1 CNT1 EQU 2 CNT2 EQU 3 PIXEL EQU 4 RED EQU 5 GREEN EQU 6 BLUE EQU 7 i EQU 8 ; --- Main Routine --- org 0x800 call Init Loop: call Rainbow12 movlw 10 call Wait_ms goto Loop ; --- Subroutines --- Rainbow12: movlw 240 movwf RED movlw 0 movwf GREEN movlw 0 movwf BLUE call PixelRGB movlw 180 movwf RED movlw 60 movwf GREEN movlw 0 movwf BLUE call PixelRGB movlw 120 movwf RED movlw 120 movwf GREEN movlw 0 movwf BLUE call PixelRGB movlw 60 movwf RED movlw 180 movwf GREEN movlw 0 movwf BLUE call PixelRGB movlw 0 movwf RED movlw 240 movwf GREEN movlw 0 movwf BLUE call PixelRGB movlw 0 movwf RED movlw 180 movwf GREEN movlw 60 movwf BLUE call PixelRGB movlw 0 movwf RED movlw 120 movwf GREEN movlw 120 movwf BLUE call PixelRGB movlw 0 movwf RED movlw 60 movwf GREEN movlw 180 movwf BLUE call PixelRGB movlw 0 movwf RED movlw 0 movwf GREEN movlw 240 movwf BLUE call PixelRGB movlw 60 movwf RED movlw 0 movwf GREEN movlw 180 movwf BLUE call PixelRGB movlw 120 movwf RED movlw 0 movwf GREEN movlw 120 movwf BLUE call PixelRGB movlw 180 movwf RED movlw 0 movwf GREEN movlw 60 movwf BLUE call PixelRGB return PixelRGB movff GREEN, PIXEL call Pixel_8 movff RED, PIXEL call Pixel_8 movff BLUE, PIXEL call Pixel_8 return PixelOff clrf PIXEL call Pixel_8 clrf PIXEL call Pixel_8 clrf PIXEL call Pixel_8 return Pixel_8 call Pixel_1 call Pixel_1 call Pixel_1 call Pixel_1 call Pixel_1 call Pixel_1 call Pixel_1 call Pixel_1 return Pixel_1 bsf PORTD,0 nop btfss PIXEL,7 bcf PORTD,0 nop nop rlncf PIXEL,F bcf PORTD,0 return Init: clrf TRISA ;PORTA is output clrf TRISB ;PORTB is output clrf TRISC ;PORTC is output clrf TRISD ;PORTD is output clrf TRISE ;PORTE is output movlw 15 movwf ADCON1 ;everyone is binary return Wait_ms: movwf CNT2 W2: movlw 10 movwf CNT1 W1: movlw 200 movwf CNT0 W0: nop nop decfsz CNT0,F goto W0 decfsz CNT1,F goto W1 decfsz CNT2,F goto W2 return end