// NeoPixel2.C // // This program drives a NeoPixel connected to RD0 // Lights spin around a NeoPixel-16 as // Red: 1 shift / 1/16 second // Green: 1 shift / second // Blue: 1 shift / 16 seconds // // Global Variables unsigned char PIXEL @ 0x000; const unsigned char MSG0[20] = "NeoPixel2.C "; unsigned char RED[12]; unsigned char GREEN[12]; unsigned char BLUE[12]; // Subroutine Declarationsb #include // Subroutines #include "lcd_portd.c" void Update_RGB(unsigned char r, unsigned char g, unsigned char b) { unsigned char i; for (i=0; i<12; i++) { RED[i] = 0; GREEN[i] = 0; BLUE[i] = 0; } RED[r] = 50; GREEN[g] = 50; BLUE[b] = 50; } void NeoPixel_Display(void) { PIXEL = GREEN[0]; asm(" call Pixel_8 "); PIXEL = RED[0]; asm(" call Pixel_8 "); PIXEL = BLUE[0]; asm(" call Pixel_8 "); PIXEL = GREEN[1]; asm(" call Pixel_8 "); PIXEL = RED[1]; asm(" call Pixel_8 "); PIXEL = BLUE[1]; asm(" call Pixel_8 "); PIXEL = GREEN[2]; asm(" call Pixel_8 "); PIXEL = RED[2]; asm(" call Pixel_8 "); PIXEL = BLUE[2]; asm(" call Pixel_8 "); PIXEL = GREEN[3]; asm(" call Pixel_8 "); PIXEL = RED[3]; asm(" call Pixel_8 "); PIXEL = BLUE[3]; asm(" call Pixel_8 "); PIXEL = GREEN[4]; asm(" call Pixel_8 "); PIXEL = RED[4]; asm(" call Pixel_8 "); PIXEL = BLUE[4]; asm(" call Pixel_8 "); PIXEL = GREEN[5]; asm(" call Pixel_8 "); PIXEL = RED[5]; asm(" call Pixel_8 "); PIXEL = BLUE[5]; asm(" call Pixel_8 "); PIXEL = GREEN[6]; asm(" call Pixel_8 "); PIXEL = RED[6]; asm(" call Pixel_8 "); PIXEL = BLUE[6]; asm(" call Pixel_8 "); PIXEL = GREEN[7]; asm(" call Pixel_8 "); PIXEL = RED[7]; asm(" call Pixel_8 "); PIXEL = BLUE[7]; asm(" call Pixel_8 "); PIXEL = GREEN[8]; asm(" call Pixel_8 "); PIXEL = RED[8]; asm(" call Pixel_8 "); PIXEL = BLUE[8]; asm(" call Pixel_8 "); PIXEL = GREEN[9]; asm(" call Pixel_8 "); PIXEL = RED[9]; asm(" call Pixel_8 "); PIXEL = BLUE[9]; asm(" call Pixel_8 "); PIXEL = GREEN[10]; asm(" call Pixel_8 "); PIXEL = RED[10]; asm(" call Pixel_8 "); PIXEL = BLUE[10]; asm(" call Pixel_8 "); PIXEL = GREEN[11]; asm(" call Pixel_8 "); PIXEL = RED[11]; asm(" call Pixel_8 "); PIXEL = BLUE[11]; asm(" call Pixel_8 "); asm(" return"); #asm 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 ((c:3971)),0 ; PORTD,0 nop btfss ((c:0000)),7 bcf ((c:3971)),0 rlncf ((c:0000)),F nop nop bcf ((c:3971)),0 return #endasm } void Wait(unsigned int X) { unsigned int i, j; for (i=0; i