Menu

MAX7219: GLCD capability.

Anobium
2018-01-08
2018-07-25
1 2 3 > >> (Page 1 of 3)
  • Anobium

    Anobium - 2018-01-08

    I was given an LED Matrix 8x32 MAX7219 over a year ago. It lay on the desk, the project was on the list. On Sunday I got to look at the LED Matrix.

    I have something that works very nicely. It is an LED Matrix that has GLCD capabilities which means you can:
    * Print text and numbers all types
    * Display special characters
    * Draw lines, circles etc
    * Set the state of the explicit pixel(s)
    * Scroll the screen
    * Controller the brightness etc.

    This is not my best demo but this does show what is possible.

    https://1drv.ms/v/s!Ase-PX_n_4cvgqgJSshbNoNiJU5Gcg

    Anyone interested in trying this ? I think that you can easily create a huge 128 x 64 LED Matrix. The approach I used was to define the number of matrixes in the X axis and the Y axis which the intent of chaining a number of devices together - I do not if this works as I only have one device. :-)

    Let me know if you have some time to play and then you can help improve the draft library.

     

    Last edit: Anobium 2018-01-08
  • Moto Geek

    Moto Geek - 2018-01-08

    Holy Smokes Evan! This is awesome work. Will be placing order for a few of these displays TODAY! Are there different variants on these? Anything to look out for when ordering?
    Awesome effort on your part, good sir!

     
    • Anobium

      Anobium - 2018-01-08

      Good to hear you are interested.

      I am not sure about the differences bewteen parts, something that we will expperience as we move forward.

      Look forward to you getting the parts.

       
  • stan cartwright

    stan cartwright - 2018-01-08

    I got 403 access denied.
    I've seen these connected to make larger display.
    I've seen ssd1306 displays connected and I have a few but the buffer ram issue. I like to do something like this but thought https://www.youtube.com/watch?v=Ktg4X0Qow_A

     
  • mkstevo

    mkstevo - 2018-01-21

    I could be able to make use of something like that.

    I'm currently using 7 segment displays using 74HC595 and ULN2003 to make a 4x 7 segment 4" display. This is working really well for almost everything, but displaying letters, while possible, is a bit limiting when it comes to 'X', 'K', 'M', 'W' and 'Z' (probably others too, but they come to mind).

    I thought of using some MAX7219 units, but I was worried about the update speed, I have to count accurately in a tight loop after updating my displays so wanted to keep the time it takes to send the display data to a minimum. 4x 7 segments (+1 for the decimal points) = 32 bits of data per display update. 4x (8x8) = 256 bits of data per display update. At an abitrary figure of 5uS per bit, I'd be going from 160uS to 1280 uS giving significantly less time for counting.

    Still, I will order a few, give them a go and see what I can come up with.

     

    Last edit: mkstevo 2018-01-21
  • JANIS

    JANIS - 2018-01-22

    Hello! Ihave exactly the same Led Matrix with MAX7219 display, and these has been standing for 2 years :). But I do not know how to start it. It would be nice if there were any examples of connecting and starting these displays, creating grafix ;)

     
    • Anobium

      Anobium - 2018-01-22

      The example code has the connection tests included!! As I found this hard!

      Funny that you asked! :-)

       
  • JANIS

    JANIS - 2018-01-22

    Maybe it's funny, but But I do not know where to find the program code for your Demo example.

     
    • Anobium

      Anobium - 2018-01-22

      I have created a GITHub rep so you can update the example code and library (.h file).

      See https://github.com/Anobium/Great-Cow-BASIC-Library-Development

      The code is development and therefore treat as such - the goal is a robust library that we can publish and a set of demonstrations. Currently the demos are within the example code with two constants controlling the usage.

      If you send me your GitHub ID then you can access and then co-develop the library.

       
  • JANIS

    JANIS - 2018-01-22

    Thanks Anobium! Now I understand, it was not so funny :)!

     
  • mkstevo

    mkstevo - 2018-01-23

    Many thanks for the code.

    I tried to compile it for the 16F1829 but I got a number of errors relating to the 'PPS' commands/variables. I'm assuming that the '1829 doesn't have these capabilities as when I tried again using the original processor type, it compiled with no 'PPS' errors only an error relating to a missing '.cnt' file which on a quick glance of the source should hold the GCB version number and/or the system time and date.

    If I could trouble you to ask:
    How do I generate the version number, time and date file (or where do I find it)?
    What would I need to define the I/O as in order to compile this for the '1829?
    Is the protocol used SPI, and could I use software SPI in place of the 'PPS' calls?

    I did wonder if my GCB installation required updating as I was running 0.98.0 from September 2017 but having done an update on my WINE installation and a fresh install on an old XP machine I still have the same problems.

    I'd been considering using my existing code for the 74HC595/ULN2003 7 segment drivers which I 'bit banged' by hand, just sending more data, but I'd like to see if I can get the library code working if I can as it will almost certainly be more elegant than mine, and I was hoping to be able to avoid mapping the fonts by hand!

     
  • Anobium

    Anobium - 2018-01-24

    You will have to remove the PPS for your chip, or, you will have to regen the PPS statements if a chip supports PPS.

    The 1829 does not support PPS therefore remove.

    Just posted https://github.com/Anobium/Great-Cow-BASIC-Library-Development/tree/master/MAX7219-LEDMATRIX-GLCD_Driver/Prototype%20Library001 This contains the code to generate the version number. Place this two files in your Converters folder.

    I do not think you need to update your installation.

    Re the 74xxxxxx. This should be possible. But, let us sort the LED Matrix out before we try the 74xxxxx support.

    Evan

     
  • mkstevo

    mkstevo - 2018-01-24

    Many thanks, I've copied the version number files as you directed.

    I'll give this another go in a minute or two.

     
  • Anobium

    Anobium - 2018-01-27

    A much improved library. https://github.com/Anobium/Great-Cow-BASIC-Library-Development/tree/master/MAX7219-LEDMATRIX-GLCD_Driver/Prototype%20Library001

    This has a suite of demos that now work as expected - text, scroll, flash, dim, lines, boxes etc etc.

    The library has been updated to remove the hard coded values and now support any size of LED matrix (well that it the intent!).

    The initial library failed to initialise the MAX7219 correctly - this library does resolve that issue.

    If your chip is not PPS, remove the PPS code.

    This only support hardware SPI at the moment. Next week (now I have a stable library) I can easily add software SPI (bit banging).

    Library support the following

    GLCD - clear the matrix
    Max7219_LEDMatrix_ScrollMessage( string, ms_delay)
    Max7219_LEDMatrix_Flash(ms_delay) - flash matrix
    Max7219_LEDMatrix_Brightness ( 0-15) - set power/dim of matrix
    Max7219_LEDMatrix_SendBuffer - send the complete buffer to the matrix. Updates matrix
    Max7219_LEDMatrix_BufferInvert - inverts matrix pixels
    Max7219_LEDMatrix_ClearBuffer - clears the matrix buffer
    PSET (x,y,0|1) - set pixels at x,y
    GLCDPrint ( x,y, string|number) - display strings or number at specific location

    How it works

    This uses a buffered memory for the matrix. This enables full control of the matrix using standard Great Cow BASIC commands.

    The buffer is updated via the standard commands then you need to Max7219_LEDMatrix_SendBuffer to update the actual matrix. This means all the GLCD commands can be made to work.

    This use 8 bytes of RAM per matrix.

    What next?

    You could build a 128 * 64 LED Matrix. You would need to ensure the power supply is adequate and you have cooling for the matrixes - a 128 * 64 may get warm!

    I have tested an 4 way Matrix and a single Matrix - the library may need updating to support the 128 * 64 but... unless someone wants to to this.. this can wait.

    Enjoy

     
    • Anobium

      Anobium - 2018-01-27

      A completed library. https://github.com/Anobium/Great-Cow-BASIC-Library-Development/tree/master/MAX7219-LEDMATRIX-GLCD_Driver/Prototype%20Library001

      This has a suite of demos that now work as expected - text, scroll, flash, dim, lines, boxes etc etc. If your specific chip does not support PPS, simply remove the PPS calls.

      This library includes Hardware and Software SPI.

      I have tested on a single LED Matrix and a Four piece LED Matrix. Works nicely.

      Library supports the following

      GLCD - clear the matrix
      Max7219_LEDMatrix_ScrollMessage( string, ms_delay)
      Max7219_LEDMatrix_Flash(ms_delay) - flash matrix
      Max7219_LEDMatrix_Brightness ( 0-15) - set power/dim of matrix
      Max7219_LEDMatrix_SendBuffer - send the complete buffer to the matrix. Updates matrix
      Max7219_LEDMatrix_BufferInvert - inverts matrix pixels
      Max7219_LEDMatrix_ClearBuffer - clears the matrix buffer
      PSET (x,y,0|1) - set pixels at x,y
      GLCDPrint ( x,y, string|number) - display strings or number at specific location

      How it works

      This uses a buffered memory for the matrix. This enables full control of the matrix using standard Great Cow BASIC commands.

      The buffer is updated via the standard commands then you need to Max7219_LEDMatrix_SendBuffer to update the actual matrix. This means all the GLCD commands can be made to work.

      This use 8 bytes of RAM per matrix.

      What next?

      You could build a 128 * 64 LED Matrix. You would need to ensure the power supply is adequate and you have cooling for the matrixes - a 128 * 64 may get warm!

      I have tested an 4 way Matrix and a single Matrix - the library may need updating to support the 128 * 64 but... unless someone wants to to this.. this can wait.

      Enjoy

       
  • Anobium

    Anobium - 2018-01-27

     
  • Anobium

    Anobium - 2018-01-27

    None of these.

     
  • Anobium

    Anobium - 2018-01-28

    This is what I am using.

    https://www.ebay.co.uk/itm/191736670249

    It is an array of 4 devices - 8 x 32 LEDS. I have just purchased another one.. to create and test the following:

    • 8 x 64 LED pixels - long version of what I have...(I have a 8 x 32)
    • 16 * 32 LED pixels

    I want to see what the best way to handle the second option - 16 * 32. Do we...
    1. Add ChipSelect line for each row of 8 pixels, or
    2. Simply string together.

    Using ChipSelect will be faster but will need an extra control line but this is resovleable via a port expander (getting complex) Stringing to together is ok for a few devices but to refresh a large matrix 128 x 64 would be slow. So, I am going for ChipSelect and some logic in the GLCD library to support this. The current library does support adding additional rows via a constant that is within the library but I did not have enough devices to test... I will soon!

    :-)

     
  • Theo

    Theo - 2018-01-28

    Evan, could you please show us a diagram of how the displays are connected?
    That would make things clear to me, and maybe others too.

     

    Last edit: Theo 2018-01-28
    • Anobium

      Anobium - 2018-01-28

      Sure.

      Using the Xpress Board as an example.

      ; ----- Constants
        'Set SPI pins for the Max7219
       #define Max7219_DI    portb.4   'define for now! I will remove from library
        #define Max7219_DO    portb.5
        #define Max7219_SCK   portb.3
        #define Max7219_CS    portc.3
      
        'Specifics for device configuration
        #define MAX7219_X_Devices 1
        #define MAX7219_LEDMatrix_HardwareSPI     ' remove and make a comment out if you want to use Software SPI for this device
      

      This requires 3 ports + 1 port and a common 0v.
      Where Max7219_DO = MOSI, Max7219_SCK = SCK(CLOCK) and Max7219_CS = ChipSelect.
      Using hardware and software SPI.
      On the XPress board the MOSI and SCK, when using hardware are b.5 and b.3 respectively. I used c.3 for ChipSelect. Please also specific Max7219_DI to a valid port but I will remove this dependency if we think we do not need it.

      Use an Low Pin Count Board - 18f14k22

      ; ----- Constants
        'Set SPI pins for the Max7219
        #define Max7219_DI    porta.0
        #define Max7219_DO    porta.0
        #define Max7219_SCK   porta.2
        #define Max7219_CS    porta.1
      
      
        'Specifics for device configuration
        #define MAX7219_X_Devices 4
      '  #define MAX7219_LEDMatrix_HardwareSPI     ' remove and make a comment out if you want to use Software SPI for this device
      

      This requires 3 ports + 1 port and a common 0v.
      Where Max7219_DO = MOSI, Max7219_SCK = SCK(CLOCK) and Max7219_CS = ChipSelect.
      Using software SPI only.

      On this board the MOSI and SCK, when using hardware are a.0 and a.2 respectively. I used a.1 for ChipSelect. Please also specific Max7219_DI to a valid port (a.0).

      **Use an UNO Board - **

      ; ----- Constants
        'Set SPI pins for the Max7219
        #define Max7219_DI    portb.4    'pin12
        #define Max7219_DO    portb.3    'pin11
        #define Max7219_SCK   portb.5    'pin13
        #define Max7219_CS    portb.2    'pin10
      
        'Specifics for device configuration
        #define MAX7219_X_Devices 1
        #define MAX7219_LEDMatrix_HardwareSPI     ' remove and make a comment out if you want to use Software SPI for this device
      

      UNO Mega328p work as shown above. Tested ok 28/01/18. I took power from the 5v rail for the 8 x 64 Four LED Matrix. Test passed.

      Connection to LED Matrix

      Common 0v
      Supply 5v (minimum on my tests is 3.8v) - I used external 5v regulated supply.
      Max7219_DO DIN on device
      Max7219_SCK CLK on device
      Max7219_CS CS on device
      Max7219_DI not connected - we should remove?

      Hope this helps.

       

      Last edit: Anobium 2018-01-28
1 2 3 > >> (Page 1 of 3)

Log in to post a comment.