Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

How do I send a pattern into an 8x32 LED matrix? I'm using the AT89S52 microcontroller with a 74HC154 4-16 line decoder, programming in C with the Keil IDE. I've done vertical scanning, but am stumped at the next step. I will include the schematic if needed. The circuit is the same with the one I include below only I don't use 74HC138, common anode matrix and I use UN2803 as a driver, I'm not using the memory

Port 1 is the column, port 2 is the row...the code :

 row = 0xFF;
     //for (j=0x01; j< 0x08; j<<=1)  {   /* scan left to right */
     for (j=0x00; j<=0x0F; j++)
     {
          E1=0;
          E2=0;
          P1 = j;
          P2 = row;
                                   /* Output to LED Port */
          for (i = 0; i < 100; i++) 
           {  /* Delay for 100 ms */
              delay ();                       /* call delay function */

           }

enter image description here

share|improve this question
add comment

1 Answer

The normal pattern for driving a MxN multiplexed LED display is to designate one direction as "rows" and the other as "columns", independent of physical layout on screen, such that the system will energize "row" wires one at a time and, while each row is sequenced, the system will energize the "column" wires for all the LEds on that row that should be lit.

Each column wire must include a device to regulate the current when it is activated (a resistor can work here), and each row wire must have a driver that can supply enough current to feed all the columns at once. Hardware does not have to allow more than one row to be driven at a time, but must allow any combination of columns to be driven.

The 74HC154 chips might work okay in row-select logic, but because only one output can be active at a time, they are not suitable for controlling columns. If you wanted to scan your "sideways", so that it was logically accessed as 32 rows and 8 columns, then the 74HC154 might be suitable for selecting a row, but then you'd have to add additional hardware to allow each row to supply enough current to drive eight LEDs, and you'd also have to add something to each output of the the UN2803 to limit currents.

More likely what you'd want to do would be to replace the 74HC154's with either a bunch of 74HC595 chips (shift registers) and resistors, or else one or more LED-driver chips which has current limiting built in (e.g. four Texas Instruments TLC5916, available from Digi-Key). Connect those chips to an SPI port from your controller, and shift out each row of data serially. If you use a low-side driver chip (like the aforementioned TLC5916) you'll have to change your row drivers to source current rather than sink it. The simplest way to do that would simply be to use eight NPN transistors, each with the collector tied to the positive rail (you could use an unregulated supply if you like), the base tied to the output of the controller or a decoder chip, and the emitter tied to an LED row.

share|improve this answer
    
so I must reverse the logic ? P2 = colum; P1= Row ?".... then the 74HC154 might be suitable for selecting a row..." I'll try this logic in the software soon... –  Rick Ant Jan 10 '12 at 1:34
    
If you want to have 32 vertical "rows", you could use a 74HC154 to select them, but the 74HC154 isn't capable of sourcing much current (nor sinking much for that matter) and driving with a 1/8 duty cycle is almost certainly better than driving with a 1/16 duty cycle. You don't indicate whether the LEDs are wired with the horizontal direction as anodes or cathodes, but I would recommend that you use strong drivers (possibly discrete transistors) for the rows and current-limiting drivers for the columns (regardless of whether the rows end up being horizontal or vertical). –  supercat Jan 10 '12 at 21:08
    
If you want your display to be bright, it will likely be necessary to have the drive current for each column wire be higher than the maximum current the LED can sustain safely. To prevent having the LEDs be damaged if the code stops running, you should probably design your row driver so that it will not drive a row for an excessive length of time even if the processor malfunctions. There are a variety of ways this can be accomplished. If one is using discrete transistors for row drivers, one could add a resistor and cap to each one to limit the maximum duty cycle. –  supercat Jan 10 '12 at 21:34
    
Alternatively, if one uses a counter to control the rows, one could use timing circuit to detect if an excessive time elapses between counts and either blank the display or generate an "automatic" count pulse. –  supercat Jan 10 '12 at 21:36
    
do you have a code example for it ? For example I want to display character A A A A ? –  Rick Ant Jan 13 '12 at 3:43
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.