; --- Rainbow750.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 movlw 250 movwf RED clrf GREEN clrf BLUE Loop: Loop1: call Display movlw 10 call Wait_ms incf GREEN,F decfsz RED, F goto Loop1 Loop2: call Display movlw 10 call Wait_ms incf BLUE,F decfsz GREEN, F goto Loop2 Loop3: call Display movlw 10 call Wait_ms incf RED,F decfsz BLUE, F goto Loop3 goto Loop ; --- Subroutines --- Display call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn call PixelOn return PixelOn 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