Cascading Max7219
bytor95
Posts: 53
I'm finally having success with my 8x8 bicolor led matrix controlled by a Max7219. I'm trying to now figure out how to cascade the MAX7219 chip to light up multiple led arrays. For the life of me, I can't figure out what to do. Does anyone have luck cascading Max7219 and can you please share your program?
Thanks in advance,
Engin
Thanks in advance,
Engin
Comments
I have posted how to cascade the MAX7219 before. All you need to do is shift the data out to all chips and latch them. Basically the MAX7219 will cascade just like a 74HC595. So if you have two you will be shifting out 4 bytes then latching. The first two bytes go to the last MAX7219 in the chain and the next 2 go to the first MAX7219 in the chain. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
As always, thanks very much. So far, I can't find your old post. If anyone can help find cascade info or links it be much appreciated. I'll keep looking though.
Thanks again,
Engin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
However, as many times before THERE IS SOMETHING STILL WRONG in this approach as I read about it on this forum and in the datasheet. It looks and sounds very clear but something is not right.
I ask humbly for someone that has gone through my headaches and fustration and solved this to help me solve this overdue problem and finally provide closure to this mystery.
As you can see by the pictures, I am using·2 8x8 LED matrixs and 2 cascaded MAX7219 ICs·as well as the modified code reflects this too.
You can see that I have inserted 0,0, in the ShowChar: routine's SHIFTOUT statement. The 0's represent NoOp commands and are in line with what Chris stated above and what the datasheet says.
If the 0,0 are removed then the first matrix (on the right) works perfectly and then the (e.g. the matrix on the left is blank). However, inserting the 0,0 always (or most of the time) causes strange patterns on the right side matrix while the left side runs as it should. If you press the reset button often enough you can get it to start with no random pattern. Almost all of the time the pattern is that almost all of the LEDs are on the right LED matrix.
But then you see the last picture #7. If the program with the 0,0 runs long enough the pattern may clear out and it runs on the left side matrix. This is odd but it does happen.
Now that I have presented pictures and code, can someone please·close the gap on this problem and explain how to properly cascade MAX7219 ICs?
Thank you for your time.
Post Edited (T&E Engineer) : 4/19/2007 1:42:27 AM GMT
· See attached.
I have never heard of this but certainly worth trying. Can someone show how this might be done and I will give it a shot tomorrow.
Thanks.
· Send Data and Clock as you would with a single matrix, but·send (pulse) HIGH·only the left or the right LOAD for the display you want to write to (it's in the drawing that I included.)
· It's pretty clear, isn't it?
· [noparse][[/noparse] LOAD is/starts LOW; SHIFTOUT your data; LOAD (LOAD Left or LOAD Right) goes HIGH and then back to LOW. ]
· The Stamp OUTs are: a DATA line common to both 7219s; a CLK line common to both 7219s; LOAD to·pick "left"; a LOAD to pick "right."
· Yes, Data and clock signals are presented to both, but the 7219 concerned only "cares" when its·[noparse][[/noparse]its own, unique]·LOAD is sent HIGH, otherwise the signals at DATA & CLK are disregarded.
· From the Datasheet:· Pin 12 of 7219 -- LOAD· Load-Data Input.· The last 16 bits of serial data are latched on LOAD's rising edge.
Post Edited (PJ Allen) : 4/19/2007 2:47:09 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Thanks for the good idea. However, what I meant was how to implement this in software. I see that you changed the drawing for 2 separate LOAD lines. I never considered this as the datasheet shows 2 attached LOAD lines not 2 separate ones - otherwise you would think it would have been stated somewheres.
I remember going down this road in the past with I beleive an 8255 or maybe it was a 595 and thinking that I must have separate CS lines or something for each chip. But Chris showed me (possibly others too) that the 3 core lines were all that was needed - so perhaps this also affected my judgement in beleieving that the LOAD lines should remain together as the datasheet shows.
I will try again tonight in software and let everyone know if it worked or not and provide as much detail as I can.
Thanks.
I still stand behind what I said earlier, but I will attempt to prove it this weekend. I certainly have the resources at home to do it. I won’t be using a dot display but the concept should be the same nonetheless. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
This means so much to me as I simply do not understand how this clear picture in the datasheet and others testimony to cascading can be this difficult to not work.
Here is what I think might be a good start (but not 100% sure).
PS: If it can be worked out...it would also be nice to see adaptations made for the commented out routines too.
I also have access to a 2 channel good PC based oscilloscope if you think I should look at any of the signals too. But a logic analyser might be a better option.
You have me at somewhat of a disadvantage…While I don’t recall ever daisy chaining the chips I believe I can do it no problem. But even though I have used these chips in dozens of projects I have yet to explore using the non-decoded mode. My goal is to display the results of two timers on two different displays connected via the MAX7219 in daisy-chain mode. I’m not quite ready to test the mode you’re using (no compatible displays). But I will post my results either way. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
This testing can probably be done with out any 8x8 (or 5x7) dot matrix displays. Even if only a few LEDs were connected to each MAX7219, then if the NoOp instructions were called out and then the LOAD pulsed, it should move all those LEDs to the next chip. Simply stating if you had (2) cascaded·MAX7219 with lets say 1 or more LEDs on each one, the LEDs should go off on one and turn on for the 2nd cascaded MAX7219. This is basically what is supposed to happen in my attached program (modified from Jon Williams N&V article). All the uncommented routine is doing is flashing on and off LEDs (that just happen to be forming letters of the alphabet - B S 2). The test is to move this to the next MAX7219. I hope I was a little more clear about this.
Right off the bat I think I see an issue in your Initialize routine…You are reading each register parameter and value and shifting them out, but you’re not shifting them out again for the second MAX7219. I don’t believe you’ll even be able to use this block of code because it is not capable of shifting out to both chips at the same time. You need to shift out a register and value twice for each LOAD you do. You’re pulsing out for both load pins, but the data you’re sending to the second unit doesn’t get there until one whole cycle after the first. I didn’t look ahead but if this is happening in your init code it’s probably happening later as well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Here is the original N&V column that Jon wrote:
http://www.parallax.com/dl/docs/cols/nv/vol2/col/nv70.pdf
I will try again with it tonight after work.
Copying the whole routine twice won’t help because that is not what is happening…Let me see if I can explain it a different way since it is a little complicated…We’ll try this approach…
When you are using one MAX7219 you need to send a register and a value for each item you’re setting up during initialization…So you will be sending the equivalent of the following…(The way the code is organized it is difficult to see this).
SHIFTOUT Dpin, Clock, MSBFIRST, [noparse][[/noparse]Scan, 7]
PULSOUT Load, 3
This is just one register, but hopefully it will make my point of sending out 16 bits of data (two bytes). Now, if you had two MAX7219 chips and wanted to initialize them the same, the previous example would look like this:
SHIFTOUT Dpin, Clock, MSBFIRST, [noparse][[/noparse]Scan, 7, Scan, 7]
PULSOUT Load, 3
Both Latch pins would be connected together. The Scan constant and value of 7 would be shifted into the first MAX7219 in the chain…The second Scan constant and value of 7 would push the first ones into the second MAX7219 in the chain. Now both MAX7219 chips have the same 16 bits sitting in their registers. When you pulse the latch/load line they both get the same data. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
That was the missing link that many others and myself have been looking for. I got it to work beautifully. I want to get the rest of the code working a bit better before I post anything.
Outstanding job!
Thank you!
However, this program (THANKS TO CHRIS SAVAGE), cascades (2) MAX7219 and (2) 8x8 DOT MATRIX LED displays and follows the same original routines.
1. Flash Characters
L Matrix - P···· R Matrix - B
············· a·················· S
············· r··················· 2
············· a···
············· l
············· l
············· a
············· x
2. Scroll Characters (left to right)
P a r a l l a x· B S 2
3. Scroll Characters (upwards)
L Matrix - P···· R Matrix - B
············· a·················· S
············· r··················· 2
············· a···
············· l
············· l
············· a
············· x
I only see 2 problems with this:
1. When scrolling left to right (#2), there is some garbage breifly flashed on the L Matrix.
2. The "P a r a l l a x· B S 2" flickers a little due to the 8x16 display.
Over all not bad - This is the first that I have seen anywheres (including the Internet) - on how to cascade more than one MAX7219 ICs. I have spent a long time working on this and thanks to Chris Savage from Parallax - the mystery is solved!
·Keep in mind this is not perfect and could have been coded better and probably still has some issues to work out to have it properly working - but for those of us that have been working with the MAX7219, this is a great begining!
See attached program.
SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]Scan,7,Scan,7]
PULSOUT Load,3
SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]Intensity,7,Intensity,7]
PULSOUT Load,3
SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]ShutDn,1,ShutDn,1]
PULSOUT Load,3
Thanks for having the energy to figure this out. I had posted the initial message and actually gave up until I saw your findings.
Thanks again,
Engin
This one really ate me up inside like I can see it did with many of us.
I will also look into porting this over to the SX28 (SX/B). However, I may also have to add some more hardware drivers to support larger displays as the half brightness / flickering on the 8x16 LED matrix follows suite with it needing more current perhaps for larger scaning areas (e.g. 8x8 to 8x16 to 16x16, ....)
It should be clear on where to attach the other 3+1 legs of an 8x8 LED Dot Matrix display if you look closely at the drawing.
However, I will try to update the drawing over the weekend between projects.
Thanks.
Engin
www.brielcomputers.com/phpBB2/viewtopic.php?p=937#937
The first time when I turn on the LED units, there is garbage displayed, this seem to be normal...
However as soon as I send valid data everything is OK...
If you have problems with random flickering, add a a bypass capacitor (I used 0.1uF) between pin 4 (GND) and pin 19 (+5V) on the MAX7219, that solved my problems...
OK, I might not convert the 6502 into Basic Stamp, but I will hook it up to my Hydra one day...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...
Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...
/Bamse