Pages: [1]   Go Down
Author Topic: TLC 5940 PWM with 74HC595 scanning , TLC.update() bleeding to next row  (Read 1279 times)
0 Members and 1 Guest are viewing this topic.
Sri Lanka
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 143
Posts: 5309
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Sri Lanka
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you  for the quick reply fungus,

I already did some modifications and tested ...
Code:
#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 ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post the full code please.  And a schematic.
Logged

Sri Lanka
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Donziboy2,
Here is the test setup and code ....  smiley-confuse

Code:
#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)
{
Tlc.clear();
Tlc.update();
 
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]);
    Tlc.update();
    delay(testT);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, a); 
    digitalWrite(latchPin, HIGH);
    delay(time);
    raw++;
  }
}
Tlc.clear();
Tlc.update();

}


void setup() {
 
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
  pinMode(clockPin, OUTPUT);
 
  Tlc.init(0);
}

void loop() {
 
ratta(1,0);

}



* test.jpg (52.52 KB, 578x638 - viewed 73 times.)
Logged

Sri Lanka
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Sri Lanka
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Were you able to get this working?
Logged

Pages: [1]   Go Up
Jump to: