; --- RGB.asm ; NeoPixel demonstration program ; NeoPixel data out = RD0 ; ; Display Red / Green / Blue on a NeoPixel #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: movlw 250 movwf RED clrf GREEN clrf BLUE call PixelRGB clrf RED movlw 250 movwf GREEN clrf BLUE call PixelRGB clrf RED clrf GREEN movlw 250 movwf BLUE call PixelRGB movlw 10 call Wait_ms goto Loop ; --- Subroutines --- 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