Pages: [1]   Go Down
Author Topic: TLC5940 library oddity  (Read 579 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34524
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) >> smiley-cool, (b)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34524
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: