Hi all.
Ive read up on this til my eyes bleed and currently i cant figure out where im going wrong with my LED matrix setup so i just wanted to clarify im not missing something...
Im using the TLC5940 Library 'AS IS' - all default ports etc alongside a 595 register for multiplexing (bit banging this as i cant get the spi to work for some reason).
When i try and multiplex i always seem to get random LEDs on above and/or below my desired position and i dont know why.
For example say i had something like this (just an example):
void loop{
Tlc.clear();//clear all outputs
if(RowLoop==0){ //if were scanning the first row then set some leds.
Tlc.set(1,4095); //turn channel 1 on to full brightness
}
Tlc.update(); //update our changes
digitalWrite(2,HIGH);
shiftOut(1,0, MSBFIRST, patterns[RowLoop]); //move a byte (B00000001,B00000010 etc) into the shift register to turn on just 1 row
digitalWrite(2,LOW);
RowLoop++; //change the row byte for the register to the next one
if(RowLoop>7){RowLoop=0;} //reset back to start
}
Is that all that is actually required to multiplex the top left LED in a matrix to red? I dont really understand how the timing of the PWM stuff works still and i cant figure out why when i code something like this in it doesnt work correctly - it seems so simple. Whenever i add any kind of delay before the loop re-runs it seems to have a big impact on which random LED lights up either side of my actual target LED.
Where am i going wrong? Is this theory i have above correct and theres no need to wait for the TLC library interupts etc before scanning to the next row - in which case could it be my shift register just doesn't update quick enough?
I dont really understand how the timing of the PWM stuff works still and i cant figure out why when i code something like this in it doesnt work correctly
It doesn't work because you are not synchronising the multiplexing whit the change of data. You can not do this without doing it in the code that actually loads the TLC.
I hacked an old version of the TLC library to allow me to use multiplexing in this project:- http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html
yeh i kinda came to that conclusion after many many MANY hours of trying different things. I did actually get it working to an extent but i ditched it because it just wasnt sitting easy with me not knowing what the majority of the code did!
Instead ive rolled right back and gone the way of using 4 595 shift registers and 4Bit software bit angular after studing every 1 of this guys videos: http://www.kevindarrah.com/ - incredibly helpful and kudos to this guy for making them!!. I decided i dont need 'true' colour for what i want to do and id rather use methods and things that i can actually follow and understand as a platform to build up from. Too much trying to run before i could walk i think!
Ive got the code running for this now, i just need to try and figure out where my circuit is going wrong as im pretty sure im not getting the brightness from my matrix that i should be. Even if i turn the multiplexing off my leds are like 20% of the brightness i know they can be and im still getting a weird ghosting effect where LEDs that shouldn't be on are ever so slightly lit up. Not sure if its my breadboard or what at this stage - need to do some more reading i think (not kidding ive read more stuff in the last 2 weeks than i have in the past 2 years!).