ws2812b_common
Common part of libraries supporting a chain of WS2812B chips
|
Author
|
Rob Hamerling, Copyright © 2014..2014, all rights reserved.
|
|
Adapted-by
|
|
|
Compiler
|
2.4q2
|
Description
Common part of several libraries to control a chain of WS2812Bs
(RGB LEDs with builtin WS2811).
See the description of the implementation variants for user guidance.
.
The main differences between the variants of the WS2812B libraries are:
- The libraries using the PIC hardware (USART or MSSP modules)
produce a signal which is generally closer to the specifications
in the datasheet than with bit-banging. This is probably the effect
of the buffering: while the MSSP or USART is busy with transmitting
a byte (with 2 or 3 WS2812B 'bits') the processor is available
to prepare the output for the next couple of bits to be transmitted.
- A disadvantage of the bit-banging method is that the compiler
generates somewhat different code for the 18Fs than for the midrange
and enhanced midrange PICs, disrupting the bit timing somewhat.
This may cause instable operation.
- When using MSSP or USART only one specific pin produces the control signal,
while with bit-banging any digital output pin can be used.
- With SPI and bit-banging the control signal can be generated with the
correct polarity. Since a USART uses negative polarity for data the signal
must be inverted. This can be done with an external circuit (a simple
one transistor inverter will do) and for Synchronous protocol this is
the only option. For Asynchronous protocol this can be used too, but some
PICs have a builtin inverter. When available the library will use
this feature to produce a positive signal (with the BAUDCON_TXCKP bit)
and no external inverter is needed.
Notes
- Interrupts are disabled during transmission of data to the chain.
Dependencies
No sample found