TLC5940 + LED matrix

Hello. I want to create a LED matrix using TLC5940 chip. The problem is - the LEDs flicker like crazy. I want to switch every column (that is, one of 16 sinks on TLC) every 1mS. I'm using Teensy 2.0++ This is the relevant code:

#define COLUMN_SWITCH_TIME        1000
#define NUMBER_OF_LED_ROWS      2
#define LED_INTENSITY_FULL           4095
#define NUMBER_OF_LEDS               16

elapsedMicros lastSwitchTime;
int8_t activeColumn;
int16_t ledState[NUMBER_OF_LEDS];

void setup() {

    lastSwitchTime = 0;
    activeColumn   = -1;

    for (int i=0; i COLUMN_SWITCH_TIME)    {

        PORTE &= 0b11001111;    //turn all rows off
        activeColumn++;         //switch to next column
        if (activeColumn == NUMBER_OF_LED_COLUMNS)  activeColumn = 0;

        for (int i=0; i 0) { 

                switch(i)   {

                    case 0:
                    PORTE |= 0b00100000;
                    case 1:
                    PORTE |= 0b00010000;



        Tlc.clear();            //turn all columns off
        Tlc.set(activeColumn, LED_INTENSITY_FULL);
        lastSwitchTime = 0;


I'm using TLC5940 library. Is that library too slow or something else is wrong?

I modified the TLC5940 library to do multiplexing for these two projects:-


The software is downloadable.

You can't do it the way you did because there is no synchronization between your code and the library.