Go Down

Topic: TLC 5940 PWM with 74HC595 scanning , TLC.update() bleeding to next row (Read 1 time) previous topic - next topic


I am using TLC 5940 PWM with 74HC595 scanning in a 24X8 RGB LED matrix.
With Arduino Mega 2650.

24 RGB lines control by TLC 5940 and 8 rows scanning by 74HC595.
shiftOut() and TLC.update() for send data. (using TLC5940.h )

TLC.update() bleeding to next row. Raw scanning with 1ms delay.
When I slow down more than 30ms, no bleeding. Its comes to effect when I speed up the scanning.
Looks like TLC.update() is bit much slow and pending updates bead to next raw.

Please help. 


You need to synchronize the row changes to the TLC PWM cycle.

The TLC library isn't really designed for that, you'll have to modify it. Maybe you could change row at the beginning of the the TLC library interrupt handler.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)


Thank you  for the quick reply fungus,

I already did some modifications and tested ...
Code: [Select]
#define TLC_PWM_PERIOD    [color=red]8192[/color]
#define TLC_GSCLK_PERIOD    [color=red]3[/color]

no good.
Any resources for dig down more in to Arduino Tlc5940 Library ? 
Section of the code in the Tlc5940 Library, handle interrupts ?



Dear Donziboy2,
Here is the test setup and code ....  :~

Code: [Select]
#include <Tlc5940.h>
#include <tlc_config.h>

//74HC595 control pins...

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;

int ledarray[8][3]={{4000,0,0},{0,4000,0},{0,0,4000},{4000,0,0},{0,4000,0},{0,0,4000},{4000,0,0},{0,4000,0}};

////////////////////////////set color function /////////////////////

void ratta(int time, int testT)
for(int z=0; z<50 ; z++){
  int raw=0;
  for(int a=1; a<129; a=a*2)

    Tlc.set(0, ledarray[raw][0]);
    Tlc.set(1, ledarray[raw][1]);
    Tlc.set(2, ledarray[raw][2]);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, a); 
    digitalWrite(latchPin, HIGH);


void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
  pinMode(clockPin, OUTPUT);

void loop() {



Now working with TLC5940.h , getting much better. Only small issue. Raw 3 and raw 7 not functioning. Just in off condition.others are fine. I have started a new thread for the issue. Thx everyone for the support given. I will post all diagrams and codes ones I get it working.
Mega 2560, TLC5940, 74hc595 and TLCMux library....


If someone interesting, still no luck. Now Trying to drive the both TLC and shift reg. from Hardware SPI, not using any libraries and update the LEDs in timer interrupt. Shiftout is slow. Can I use both TLC5490 and the 74hc595 in same SPI ?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131