If i understand you correctly, the rows would be "positive" and the columns "negative".
Yes.
But with this the PNP transistor in the row would be required to be able do source all the current for the columns, so if i do a 24x8 i would need something like (20mA * 24 = 480mA) ?
Otherway around - PNPs source 20mA each, NPNs sink 20mA * # of LEDs in a column.
I suppose you could multiplex by Row instead of by Column. I find it easier to think of the other way.
Say you had text to display and you wanted to scroll it.
Take the letter A below for example:
01110
01110
11011
11011
11111
11111
11011
11011
column 0 is 00111111 = 0x3f
column 1 is 11111111 = 0xff
column 2 is 11001100 = oxcc
column 3 is 11111111 = oxff
column 4 is 00111111 = 0x3f
so I would store that in memory as
byte fontArray[] = {
0x3f, 0xff, 0xcc, 0xff, 0x3f, // A
};
and to display a simple loop might be this, blink without delay and with a "manual' for-loop to keep track of where you are.
void loop(){
currentMillis = millis();
elapsedMillis = currentMillis - previousMillis();
if (elapsedMillis >= muxDuration){
previousMillis = previousMillis + muxDuration;
}
columnCount = columnCount +1;
if (columnCount == 5){columnCount = 0;} // reset column tracking
// turn off prior cathodes
digitalWrite (ssPinC, LOW);
SPI.transfer[0);
digitalWrite (ssPinC, HIGH);
// set up anodes
digitalWrite (ssPin, LOW);
SPI.transfer[fontArray[columnCount]);
digitalWrite (ssPin, HIGH);
// turn on cathode
digitalWrite (ssPinC, LOW);
SPI.transfer[cathodeArray[columnCount]);
digitalWrite (ssPinC, HIGH);
}
Add a 2nd blink without delay loop to change the letter being displayed. Maybe have the letters in a larger array and just move columnCount across the columns to control what is multiplexed:
0-4, then 100mS later 1-5, 2-6, 3-7, 4-8 etc.
Or a wider swath if the display is wider, say 16 columns:
0-15, 1-16, 2-17, 3-18, etc.