Thanks. All good stuff. I think we are getting near the limit.
The actual output to the WS2812B 1024 NeoPixel array is handled by the large mixed basic/assembler subroutine below.
I made a couple of small mods so it could work with 1024 leds and one data array holding the LED colour info encoded in bits 5,6,7 and brightness from 0-31 in bits 0-4.
I found brightness of 31 was really bright enough for daytime use and kept power supply requirements within reasonable wall wart limits.
So once the NeoLed array is loaded with the data this routine is called and loops until all 1024 led data has been output.
Code:
NeoPixelASM64:'------------- subroutine call name ----------------
POINTER = NEO_NUM - 1 'THIS SCHEME USED TO ELIMINATE USING "< or >" COMPARE STATEMENTS
SCRATCH = NEO_NUM - 1 'THIS SCHEME USED TO ELIMINATE USING "< or >" COMPARE STATEMENTS
DOGREEN:
NeoPixel = SCRATCH - POINTER 'PUSH PIXELS FROM LOWEST to HIGHEST! DON'T ASK ME WHY?
NeoPixValue = NeoLed(NeoPixel) 'First, the Green array
'Colours %000 10000 (Bits 0-4 Intensity 32 steps 0-31 Default 31) Bits 5-6-7 (001 Red D32) (010 Green D64) (100 Blue D128)
If NeoPixValue.6 = 1 then
NeoPixValue = NeopixValue & Brightness 'Clear Colour bits & set Green Intensity
else
NeoPixValue = 0 'Turn LED Off
endif
NEOPIN = 1
ASM
btfsc _NeoPixValue, 007h
Bra doneg70
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg71
doneg70
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg71
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 006h
Bra doneg60
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg61
doneg60
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg61
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 005h
Bra doneg50
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg51
doneg50
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg51
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 004h
Bra doneg40
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg41
doneg40
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg41
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 003h
Bra doneg30
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg31
doneg30
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg31
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 002h
Bra doneg20
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg21
doneg20
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg21
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 001h
Bra doneg10
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg11
doneg10
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg11
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 000h
Bra doneg00
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneg01
doneg00
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneg01
endasm
NeoPixValue = NeoLed(NeoPixel) 'Second, the Red array
'Colours %000 10000 (Bits 0-4 Intensity 32 steps 0-31 Default 31) Bits 5-6-7 (001 Red D32) (010 Green D64) (100 Blue D128)
If NeoPixValue.5 = 1 then
NeoPixValue = NeoPixValue & Brightness 'Clear Colour bits & set Red Intensity
else
NeoPixValue = 0 'Turn LED Off
endif
NEOPIN = 1
ASM
btfsc _NeoPixValue, 007h
Bra doneb70
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb71
doneb70
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb71
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 006h
Bra doneb60
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb61
doneb60
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb61
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 005h
Bra doneb50
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb51
doneb50
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb51
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 004h
Bra doneb40
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb41
doneb40
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb41
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 003h
Bra doneb30
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb31
doneb30
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb31
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 002h
Bra doneb20
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb21
doneb20
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb21
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 001h
Bra doneb10
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb11
doneb10
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb11
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 000h
Bra doneb00
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doneb01
doneb00
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doneb01
endasm
NeoPixValue = NeoLed(NeoPixel) 'Lastly, the Blue array
'Colours %000 10000 (Bits 0-4 Intensity 32 steps 0-31 Default 31) Bits 5-6-7 (001 Red D32) (010 Green D64) (100 Blue D128)
If NeoPixValue.7 = 1 then
NeoPixValue = NeoPixValue & Brightness 'Clear Colour bits & set Blue Intensity
else
NeoPixValue = 0 'Turn LED Off
endif
NEOPIN = 1
ASM
btfsc _NeoPixValue, 007h
Bra doner70
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner71
doner70
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner71
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 006h
Bra doner60
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner61
doner60
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner61
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 005h
Bra doner50
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner51
doner50
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner51
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 004h
Bra doner40
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner41
doner40
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
; Bcf LATA,3
NOP
NOP
NOP
NOP
NOP
NOP
doner41
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 003h
Bra doner30
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner31
doner30
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner31
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 002h
Bra doner20
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner21
doner20
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner21
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 001h
Bra doner10
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner11
doner10
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner11
ENDASM
NEOPIN = 1
ASM
btfsc _NeoPixValue, 000h
Bra doner00
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
bra doner01
doner00
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ENDASM
NEOPIN = 0
ASM
NOP
NOP
NOP
NOP
NOP
NOP
doner01
endasm
POINTER = POINTER - 1 'next pixel in the string
IF POINTER.15 = 0 THEN DOGREEN' < NEO_NUM THEN DOGREEN
return 'get back to main program.........
Bookmarks