I am after such a project too. Unfortunately Assembly is not too friendly.
I found this AN from Microchip, AN1606 that uses the CLC module on some new chips, like the 16F1509.
After a cryptic analysis of the timing using TMR, PWM and CLC modules, the AN claims that can produce the strict timing required for the WS2811 chip.
Well, only the setting is shown and not the use of this settings on the PIC.
Anyone has any idea how to use the PIC for sending the RGB data?
Following is the settings for the 1509 registers to obtain the correct timing on the RC4/CLC4 port pin #6, based on the slow mode of WS2811.
Code:
' Initialize PIC16(L)F1509 CLC2, CLC4, Timer2, and MSSP
' for WS2811 signal transmission protocol
' Loading SSP1BUF register sends that data byte out the RC4/CLC4 pin
' PWM1 routed straight through CLC2
CLC2GLS0 = $20
CLC2GLS1 = $00
CLC2GLS2 = $00
CLC2GLS3 = $00
CLC2SEL0 = $00
CLC2SEL1 = $06
CLC2POL = $0E
CLC2CON = $82;
' (SPI SDO & SPI CLK) || (nSPI SDO & SPI CLK & PWM1)
' PWM1 comes through CLC2
CLC4GLS0 = $44
CLC4GLS1 = $10
CLC4GLS2 = $80
CLC4GLS3 = $20
CLC4SEL0 = $50
CLC4SEL1 = $05
CLC4POL = $01
CLC4CON = $C0
' Adjust Timer2 period for desired baud rate
' One bit period is two Timer2 periods
T2CON = $04
PR2 = 5
' Adjust PWM1 duty cycle for desired "0" data-bit duty cycle
' ‘1’ data-bit duty cycle is automatically 50%
PWM1CON = $E0
PWM1DCH = 2
PWM1DCL = 0
' MSSP configured for SPI master with Timer2_Period/2 clock
SSP1CON1 = $23
' Output on RC4/CLC4
TRISC = $EF
Any help appreciated.
Ioannis
Bookmarks