Go Down

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

al3ph

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 ?

ta

al

Grumpy_Mike

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.

al3ph

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)

al3ph

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

Grumpy_Mike

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
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview