Shop OBEX P1 Docs P2 Docs Learn Events
LED Matrix Question — Parallax Forums

LED Matrix Question

sjogansjogan Posts: 17
edited 2013-05-06 17:05 in Propeller 1
I'm about to start working on lighting up an 8X8 LED matrix, and I have a programming question that's on my mind.

I am using a Propeller chip (naturally) and will be using two 74HC595 chips to light up the LED matrix. (with corresponding transistors to sink the cathodes, since the 595 can not do that by themselves.)

I am currently using jm_595_ez from the OBEX (from a previous project) and I expect to continue using it for this matrix. (thanks Jon!)

My question is: am I going to have two loops, one inside the other, to control the Row and Columns? I cannot imagine not having them looping like that, but I was wondering if there was a better way.

(the outer loop controlling the Rows and the inner loop controlling the Columns. or vice versa)

And I am expecting to have two instances of the jm_595 running, one for the rows and one for the columns.


If anyone knows of a better (or at least different) way of doing this, please let us know.

thank you

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-11 21:12
    You might not need transistors to sink the current if you use a high power shift register.

    I had 595 chips turn on and off SN754410 chips to source current to some hgh power LEDs (6 x 6 array) and I used the high power shift registers to sink the current. (I used these chips since I knew how to use them. There are probably better ways to power a LED array though.)

    There's also the option of just adding more 595 chips. With eight chips, you wouldn't need to worry about controlling the cathode. This isn't a very practical approach but it's what I used to drive a 10 by 12 array.
  • LawsonLawson Posts: 870
    edited 2012-05-11 21:20
    Why not put the 74HC595's in series and clock the row and column data out at the same time? Then the loop would be; combine row and column data, clock all 16-bits out, strobe the latches, prepare for the next line, and repeat.

    Lawson
  • kwinnkwinn Posts: 8,697
    edited 2012-05-11 22:23
    You could cascade the '595's and shift out row and column data at one time. Then you would only need one loop. For driving the leds you might want to consider using a TPIC6595 ( a '595 + uln2803 in 1 chip) and a high side driver instead of 595's.
  • pjvpjv Posts: 1,903
    edited 2012-05-11 23:10
    Hi sjogan;

    All valid suggestions.

    Or, if you use somewhat higher efficiency LEDs (mine run nicely on 1 mA, and are very bright at 5 mA), you can run it all in a multiplexed manner straight from a Prop with NO external hardware!

    Just sayin'

    Cheers,

    Peter (pjv)
  • JonnyMacJonnyMac Posts: 9,098
    edited 2012-05-11 23:17
    If pins aren't the issue I'd go with Peter's suggestion. I'd also write a multiplexer cog in PASM -- would be pretty easy for a simple 8x8 array.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-11 23:26
    I'd use separate, non-cascaded shift registers for the row and column data. The reason is that one of them will have only one bit active at a time, and all you need to do is clock it to shift that bit to the next row or column. You could even configure it to recirculate the bit automatically without having to reload it every seven or eight cycles. Better still, the pin that latches the data in the '595 can be the same pin that clocks the other shift register.

    -Phil
  • sjogansjogan Posts: 17
    edited 2012-05-12 12:17
    so you are saying that I can concatenate two partial shift registers together (one for the rows and one for the columns) and then push it to the '595? I was under the impression that if I tried that, it would add the two lines together and i would get garbage being push to the 595.

    I'd use separate, non-cascaded shift registers for the row and column data. The reason is that one of them will have only one bit active at a time, and all you need to do is clock it to shift that bit to the next row or column. You could even configure it to recirculate the bit automatically without having to reload it every seven or eight cycles. Better still, the pin that latches the data in the '595 can be the same pin that clocks the other shift register.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-12 13:01
    Here's an example of what I'm talking about. It's for a 7-segment display, but the principle is the same:

    attachment.php?attachmentid=92467&d=1336852811

    The cathodes are driven from the 74HCT595; the anodes, from the 74HCT164. The data in the '164 is shifted on the rising edge of the '595's RCK clock. Whether or not a "1" is shifted in depends on the phase of SCK when RCK is sent, which is under software control. You do not need two '595s. The simpler '164 is adequate to replace one of them.

    -Phil
    1019 x 777 - 51K
  • sjogansjogan Posts: 17
    edited 2012-05-31 18:33
    after looking into Jon's sample code and his notes in the spin program, i was able to figure out what i was missing. There is a 'out1' for a single 595, but a 'out2' for two 595 chips.

    and i figure i can use out3 and create an out4 if need.

    way cool.

    thanks.
  • saaiimsaaiim Posts: 1
    edited 2013-05-06 04:17
    hi every one i am beginner in microcontroller i am using pic18f4520 microcontroller to display single character e.g B plz help me in programming looking forward for your reply
    regards
    led matrix.JPG
    1024 x 768 - 127K
  • PaulPaul Posts: 263
    edited 2013-05-06 17:05
    Saaiim, my friend. It seems you have gotten to the wrong forum. I'd look around http://www.microchip.com/forums/ for advise.

    Good luck.

    Paul
Sign In or Register to comment.