Shop OBEX P1 Docs P2 Docs Learn Events
Cascading Max7219 — Parallax Forums

Cascading Max7219

bytor95bytor95 Posts: 53
edited 2007-04-20 21:20 in BASIC Stamp
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

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-05 21:12
    Hello,

    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
  • bytor95bytor95 Posts: 53
    edited 2007-03-05 22:30
    Chris,

    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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-05 23:14
    The datasheet basically explains it the same way…If you have two 74HC595’s connected and you want to output two bytes, the first byte you output goes to the first 595. The second byte shifts the first one to the second while it goes into the first. Then you latch them. This is the same with the MAX7219…The serial output goes to the serial input in a daisy chain. Both devices share the same clock line, and in theory you could even share the latch line if you always output to both (use a subroutine). Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 01:17
    I decided to take another look at this cascading issue that many people may still be having issues with getting it to work. I have attached 3 + 1·pictures from a striped down routine that Jon Williams wrote for N&V a few years back. It represents a good test for the cascading feature.

    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.

    ' Listing 1
    ' Nuts & Volts - February 2000 - Modified for an 8x8 LED Matrix Display
    ' -----[noparse][[/noparse] Title ]-----------------------------------------------------------
    '
    ' File...... LEDARRAY_MOD.BS2
    ' Purpose... Uses the MAX7219 to drive a 8x8 LED array
    ' Author.... Jon Williams / Tim Gilmore
    ' E-mail.... [url=mailto:jonwms@aol.com]jonwms@aol.com[/url] / [url=mailto:gilmoret@us.saic.com]gilmoret@us.saic.com[/url]
    ' Started... 06 JAN 2001
    ' Updated... 18 APR 2007
    ' {$STAMP BS2}
    
    ' -----[noparse][[/noparse] Program Description ]---------------------------------------------
    '
    ' Demonstrates the use of Maxim's MAX7219 LED display driver in the
    ' non-decoded mode.  In this mode, the programmer is responsible for
    ' sending segment (row) data for each digit (column).
    '
    ' In this application, the MAX7219 is connected to a common-cathode LED
    ' array.  The array is 8 columns wide by 8 rows tall (64 LEDs).  The
    ' digit outputs from the MAX7219 are connect to the columns; the segment
    ' control lines to the rows.
    '
    ' MAX7219 --> LED Connections:
    '
    '   MAX7219.2  (0) --> Col 1 (left)
    '   MAX7219.11 (1) --> Col 2
    '   MAX7219.6  (2) --> Col 3
    '   MAX7219.7  (3) --> Col 4
    '   MAX7219.3  (4) --> Col 5
    '
    '   MAX7219.17 (g) --> Row 1 (top)
    '   MAX7219.15 (f) --> Row 2
    '   MAX7219.21 (e) --> Row 3
    '   MAX7219.23 (d) --> Row 4
    '   MAX7219.20 (c) --> Row 5
    '   MAX7219.16 (b) --> Row 6
    '   MAX7219.14 (a) --> Row 7
    
    ' -----[noparse][[/noparse] Revision History ]------------------------------------------------
    '
    ' 07 JAN 2001 - Version 1
    ' 17 APR 2007 - Version 2 modified for an 8x8 LED Display Matrix
    
    ' -----[noparse][[/noparse] I/O Definitions ]-------------------------------------------------
    '
    Clock     CON   0         ' shift clock to MAX7219
    DPin      CON   1         ' shift data to MAX7219
    Load      CON   2         '
    
    ' -----[noparse][[/noparse] Constants ]-------------------------------------------------------
    '
    Decode    CON   $09         ' bcd decode
    Intensity CON   $0A         ' brightness
    Scan      CON   $0B         ' scan (column) limit
    ShutDn    CON   $0C         ' shutdown (1 = on)
    Test      CON   $0F         ' display test mode
    NoOp      CON   $00
    Yes       CON   1
    No        CON   0
    
    ' -----[noparse][[/noparse] Variables ]-------------------------------------------------------
    '
    index     VAR   Nib         ' loop counter
    idxOdd    VAR   index.BIT0  ' is index odd? (1 = yes)
    d7219     VAR   Byte        ' data for MAX7219
    char      VAR   Byte        ' character ee address
    col       VAR   Nib         ' column value
    row       VAR   Nib         ' row value
    eeAddr1   VAR   Byte        ' ee pointer
    eeAddr2   VAR   Byte
    vScroll   VAR   Word         ' scrolling data buffer
    ' -----[noparse][[/noparse] EEPROM Data ]-----------------------------------------------------
    '
    Char_Space  DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   0         ' column between characters
    Char_B      DATA   %00000000
                DATA   %00000000
                DATA   %01111111      ' xxxxxxx
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %00110110      ' .xx.xx.
                DATA   %00000000
                DATA   0
    Char_S      DATA   %00000000
                DATA   %00000000
                DATA   %00100110      ' .x..xx.
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %00110010      ' .xx..x.
                DATA   %00000000
                DATA   0
    Char_2      DATA   %00000000
                DATA   %00000000
                DATA   %01000010      ' x....x.
                DATA   %01100001      ' xx....x
                DATA   %01010001      ' x.x...x
                DATA   %01001001      ' x..x..x
                DATA   %01000110      ' x...xx.
                DATA   %00000000
    Pad         DATA   0,0,0,0,0,0,0,0
                DATA   0
    
    ' -----[noparse][[/noparse] Initialization ]--------------------------------------------------
    '
    Initialize:
      DIRL = %111               ' clock, data and load pins
      FOR index = 0 TO 7
        LOOKUP index,[noparse][[/noparse]Scan,7,Intensity,7,ShutDn,1],d7219
        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]d7219]
        IF idxOdd = No THEN NoLoad
        PULSOUT Load,3            ' load parameter
      NoLoad:
      NEXT
    
    ' -----[noparse][[/noparse] Main Code ]-------------------------------------------------------
    '
    Main:
    Flash_Characters:            ' on screen, one at a time
      FOR char = 0 TO 3
        LOOKUP char,[noparse][[/noparse]Char_B,Char_S,Char_2,Char_Space],eeAddr1
        GOSUB ShowChar
        PAUSE 1000
      NEXT
    
    'Crawl_Characters:            ' crawl on (horizontally)
    '  FOR eeAddr1 = Char_Space TO Pad
    '    GOSUB ShowChar
    '    PAUSE 125
    '  NEXT
    '  PAUSE 1000
    
    'Scroll_Characters:            ' scroll on (vertically)
    '  FOR char = 0 TO 3
    '    LOOKUP char,[noparse][[/noparse]Char_Space,Char_B,Char_S,Char_2],eeAddr1
    '    LOOKUP char,[noparse][[/noparse]Char_B,Char_S,Char_2,Char_Space],eeAddr2
    '    FOR row = 1 TO 8
    '      FOR col = 1 TO 8
    '        READ (eeAddr1 + col - 1),vScroll.LOWBYTE
    '        READ (eeAddr2 + col - 1),vScroll.HIGHBYTE
    '        d7219 = vScroll >> (row - 1)   ' get "frame"
    '        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]NoOp, NoOp]
    '        'SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219]
    '        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219]
    '        PULSOUT Load,3
    '      NEXT
    '      PAUSE 125
    '    NEXT
    '  NEXT
    '  PAUSE 1000
     
      GOTO Main
      END
    
    ' -----[noparse][[/noparse] Subroutines ]-----------------------------------------------------
    '
    ShowChar:
      FOR col = 1 TO 8            ' character is 5 columns wide
        READ (eeAddr1 + col - 1),d7219      ' read column data from EEPROM
     
        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219,0,0]
     
        PULSOUT Load,3
      NEXT
      RETURN
    


    Post Edited (T&E Engineer) : 4/19/2007 1:42:27 AM GMT
    640 x 480 - 148K
    640 x 480 - 144K
    640 x 480 - 148K
    640 x 480 - 144K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-04-19 01:47
    · I wonder whether the 7219 can be cascaded as in your application (dot-matrix).· How about sharing DATA IN and CLK, but each having its own LOAD (/CS -- "chip select" line)?

    · See attached.
    697 x 351 - 35K
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 02:01
    PJ Allen,

    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.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-04-19 02:33
    T&E Engineer asked... Can someone show how this might be done and I will give it a shot tomorrow.
    · I think that I just did.
    · 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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-19 03:08
    If a solution isn’t found on this I may be interested in trying myself this weekend since I have the equipment to log exactly what is happening on all lines from both chips at the same time (read: logic analyzer). That should shed some light on things right there. If in the mean time you solve the issue that is good as well. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 12:49
    PJ Allen,

    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.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-19 15:06
    Tim,

    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
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 15:11
    Chris,
    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.
    ' Listing 1
    ' Nuts & Volts - February 2000 - Modified for an 8x8 LED Matrix Display
    ' -----[noparse][[/noparse] Title ]-----------------------------------------------------------
    '
    ' File...... LEDARRAY_MOD.BS2
    ' Purpose... Uses the MAX7219 to drive a 8x8 LED array
    ' Author.... Jon Williams / Tim Gilmore
    ' E-mail.... [url=mailto:jonwms@aol.com]jonwms@aol.com[/url] / [url=mailto:gilmoret@us.saic.com]gilmoret@us.saic.com[/url]
    ' Started... 06 JAN 2001
    ' Updated... 18 APR 2007
    ' {$STAMP BS2}
    
    ' -----[noparse][[/noparse] Program Description ]---------------------------------------------
    '
    ' Demonstrates the use of Maxim's MAX7219 LED display driver in the
    ' non-decoded mode.  In this mode, the programmer is responsible for
    ' sending segment (row) data for each digit (column).
    '
    ' In this application, the MAX7219 is connected to a common-cathode LED
    ' array.  The array is 8 columns wide by 8 rows tall (64 LEDs).  The
    ' digit outputs from the MAX7219 are connect to the columns; the segment
    ' control lines to the rows.
    '
    ' MAX7219 --> LED Connections:
    '
    '   MAX7219.2  (0) --> Col 1 (left)
    '   MAX7219.11 (1) --> Col 2
    '   MAX7219.6  (2) --> Col 3
    '   MAX7219.7  (3) --> Col 4
    '   MAX7219.3  (4) --> Col 5
    '
    '   MAX7219.17 (g) --> Row 1 (top)
    '   MAX7219.15 (f) --> Row 2
    '   MAX7219.21 (e) --> Row 3
    '   MAX7219.23 (d) --> Row 4
    '   MAX7219.20 (c) --> Row 5
    '   MAX7219.16 (b) --> Row 6
    '   MAX7219.14 (a) --> Row 7
    
    ' -----[noparse][[/noparse] Revision History ]------------------------------------------------
    '
    ' 07 JAN 2001 - Version 1
    ' 17 APR 2007 - Version 2 modified for an 8x8 LED Display Matrix
    
    ' -----[noparse][[/noparse] I/O Definitions ]-------------------------------------------------
    '
    Clock     CON   0         ' shift clock to MAX7219
    DPin      CON   1         ' shift data to MAX7219
    Load      CON   2         '
    
     
    Load2     CON   3
     
    ' -----[noparse][[/noparse] Constants ]-------------------------------------------------------
    '
    Decode    CON   $09         ' bcd decode
    Intensity CON   $0A         ' brightness
    Scan      CON   $0B         ' scan (column) limit
    ShutDn    CON   $0C         ' shutdown (1 = on)
    Test      CON   $0F         ' display test mode
     
    NoOp      CON   $00
     
    Yes       CON   1
    No        CON   0
    
    ' -----[noparse][[/noparse] Variables ]-------------------------------------------------------
    '
    index     VAR   Nib         ' loop counter
    idxOdd    VAR   index.BIT0  ' is index odd? (1 = yes)
    d7219     VAR   Byte        ' data for MAX7219
    char      VAR   Byte        ' character ee address
    col       VAR   Nib         ' column value
    row       VAR   Nib         ' row value
    eeAddr1   VAR   Byte        ' ee pointer
    eeAddr2   VAR   Byte
    vScroll   VAR   Word         ' scrolling data buffer
    ' -----[noparse][[/noparse] EEPROM Data ]-----------------------------------------------------
    '
    Char_Space  DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   %00000000
                DATA   0         ' column between characters
    Char_B      DATA   %00000000
                DATA   %00000000
                DATA   %01111111      ' xxxxxxx
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %00110110      ' .xx.xx.
                DATA   %00000000
                DATA   0
    Char_S      DATA   %00000000
                DATA   %00000000
                DATA   %00100110      ' .x..xx.
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %01001001      ' x..x..x
                DATA   %00110010      ' .xx..x.
                DATA   %00000000
                DATA   0
    Char_2      DATA   %00000000
                DATA   %00000000
                DATA   %01000010      ' x....x.
                DATA   %01100001      ' xx....x
                DATA   %01010001      ' x.x...x
                DATA   %01001001      ' x..x..x
                DATA   %01000110      ' x...xx.
                DATA   %00000000
    Pad         DATA   0,0,0,0,0,0,0,0
                DATA   0
    
    ' -----[noparse][[/noparse] Initialization ]--------------------------------------------------
    '
    Initialize:
      DIRL = %111               ' clock, data and load pins
      FOR index = 0 TO 7
        LOOKUP index,[noparse][[/noparse]Scan,7,Intensity,7,ShutDn,1],d7219
        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]d7219]
        IF idxOdd = No THEN NoLoad
      
        PULSOUT Load,3            ' load parameter
        
        PULSOUT Load2,3
      
      NoLoad:
      NEXT
    
    ' -----[noparse][[/noparse] Main Code ]-------------------------------------------------------
    '
    Main:
    Flash_Characters:            ' on screen, one at a time
      FOR char = 0 TO 3
        LOOKUP char,[noparse][[/noparse]Char_B,Char_S,Char_2,Char_Space],eeAddr1
        GOSUB ShowChar
        PAUSE 1000
      NEXT
    
    'Crawl_Characters:            ' crawl on (horizontally)
    '  FOR eeAddr1 = Char_Space TO Pad
    '    GOSUB ShowChar
    '    PAUSE 125
    '  NEXT
    '  PAUSE 1000
    
    'Scroll_Characters:            ' scroll on (vertically)
    '  FOR char = 0 TO 3
    '    LOOKUP char,[noparse][[/noparse]Char_Space,Char_B,Char_S,Char_2],eeAddr1
    '    LOOKUP char,[noparse][[/noparse]Char_B,Char_S,Char_2,Char_Space],eeAddr2
    '    FOR row = 1 TO 8
    '      FOR col = 1 TO 8
    '        READ (eeAddr1 + col - 1),vScroll.LOWBYTE
    '        READ (eeAddr2 + col - 1),vScroll.HIGHBYTE
    '        d7219 = vScroll >> (row - 1)   ' get "frame"
    '        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]NoOp, NoOp]
    '        'SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219]
    '        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219]
    '        PULSOUT Load,3
    '      NEXT
    '      PAUSE 125
    '    NEXT
    '  NEXT
    '  PAUSE 1000
     
      GOTO Main
      END
    
    ' -----[noparse][[/noparse] Subroutines ]-----------------------------------------------------
    '
    ShowChar:
      FOR col = 1 TO 8            ' character is 5 columns wide
        READ (eeAddr1 + col - 1),d7219      ' read column data from EEPROM
        
        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]col,d7219]
        
        PULSOUT Load,3
     
        SHIFTOUT Dpin,Clock,MSBFIRST,[noparse][[/noparse]NoOp,NoOp]
     
        PULSOUT Load2,3
     
      NEXT
      RETURN
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-19 15:20
    Tim,

    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
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 15:42
    Chris,

    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.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-19 15:55
    Tim,

    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
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 17:40
    I thought it was something to do with the Initialization routine too. Last night I tried just copying the routine twice (when I had only 1 LOAD line) and it did not help either.

    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.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-19 21:47
    Tim,

    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
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-19 23:54
    Chris,

    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!
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-20 03:33
    Here is some working code modified from Jon Williams original program of Dot Matrix LED scanning with a MAX7219.

    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.
  • bytor95bytor95 Posts: 53
    edited 2007-04-20 13:31
    I can't believe you solved this. The scary part is that I think I got close when I tried and got your exact results and I thought I tried everything but I never tried:

    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
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-20 13:42
    Like you I gave up too because it wasn't really clear on how to do this in the datasheet nor was there anything posted on the forum on cascading MAX7219 ICs either. But I came back and Chris was graciously able to figure it out.

    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, ....)
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-20 18:06
    I just realized that the attached drawing is for a LPT747 5x7 LED Dot Matrix.

    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.
  • bytor95bytor95 Posts: 53
    edited 2007-04-20 19:56
    I figured that. lol

    Engin
  • BamseBamse Posts: 561
    edited 2007-04-20 21:20
    I got three MAX7219 cascaded on my Replica and it works fine...

    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... smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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
Sign In or Register to comment.