On Fri, 15 Aug 2014 13:11:53 -0400, you wrote: >Hi all, > >As I've alluded to in a few other posts, I'm working on controlling >the WS2812 LEDs. I am interested in them because they are an RGB LED >with built in control electronics. Adafruit sells them as NeoPixels. >They rely on a serial data stream to load their internal PWM >registers. I think they could be extremely useful as indicator LEDs as >they only require 1 port pin, but can be any colour I choose. Plus, >they are chainable, so adding more LEDs doesn't require any more port >pins. > >I'm using this as an intro to programming in C. At the moment I'm >using a PIC18f25k22 running at 64MHz (16MHz x4PLL). I'm using the MSSP >in SPI mode to control the LEDs, using some clever ideas I picked up >here: https://www.insomnialighting.com/products/rgbsmdws2811.html . >The super quick summary is that we're ignoring the clock line, and >using two different 8 bit numbers to approximate the timing that the >LED is expecting when squirted out the SDO line. It's pretty clever, >and also frees us from having to sit in some tight timing loops and >toggle the line manually. It does lead to a bit of confusion though as >each byte that we're transmitting out of the MSSP is actually one bit >to the LEDs. if you can arrange the right bit rate, you can get one WS2812 bit per 3 SPI= bits. Using a lookup table can reduce the amount of bit-twiddling if necessary. Much more efficient on a 16 or 32 bit SPI port but should be doable on an 8= -bit one if you can get a 400ns bit time- not familiar with the PIC18 SPIs but I've done it on a PIC3= 2 --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .