Go Down

Topic: TLC5940 library oddity (Read 887 times) previous topic - next topic


In my TLC5940 adventures I`ve come across an oddity, when setting an animation array structure using the GS_DUO macro I`ve found that values above 1024 start lighting up the second LED, from the documentation it should have a range of 0-4095.

Has anyone else seen this effect ?




No not seen that at all. As the control range is 12 bits a byte and a half are used for each LED. If you get the algorithm wrong you could be putting the data into the wrong place.


yeah that`s what I thought, but in this case I`m using the macro from the example, so I shouldn`t be able to mess that up, maybe his macro is buggy.

 /** Arranges 2 grayscale values (0 - 4095) in the packed array format (3 bytes).
   This is for array initializers only: the output is three comma seperated
   8-bit values. */
#define GS_DUO(a, b)    ((a) >> 4), ((a) << 4) | ((b) >> 8), (b)


hmmm thinking about it his macro doesn`t do any casting, wonder if that might be the problem.


Yes if the values going in as a & b are bigger than 255 then it will give trouble. Not sure a cast would help be certainly a val &= 0xff to limit the value to 255 might no go amiss.

Go Up