Monday, July 22, 2013

AVR Atmega MAX7219 7-segment / led matrix display driver library

The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs.



MAX7219 can refresh leds reducing the micro utilization.
This library use 3 ports to control MAX7219 ic. It can control more than one ic, without the need of SPI. User can setup scan limit, intensity and other parameter of the ic.



Setup parameters are stored in file max7219.h

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1MHz.

Code

Notes
  • read risk disclaimer
  • excuse my bad english

11 comments:

  1. Hi! I'm using the same LED modules and ATMega644PA. I've built your example code (unmodified) using Atmel Studio 6. Unfortunately, something is wrong and pixels "run" only by 1st line of each module... Can you help?

    ReplyDelete
    Replies
    1. Hello, this project is compiled with avrgcc, as far as i know Atmel Studio run avrgcc as default compiler, so it should not be the compiler the source of your problem. So, double check your wiring, and check that you are running the micro at the proper speed, check fuses. If those check passes, check with a logic analizer, what's going on the input pins of the MAX7219. If you do not have a logic analizer, import a uart library, and debug using some uart output to your terminal.

      Delete
    2. Hello, have you try all the suggestions I've tell on the comment above here?

      Delete
    3. I have try, use avr-gcc. Its OK, no problem.

      Delete
  2. Really thanks for the blog and the code :)

    Good luck,

    ReplyDelete
    Replies
    1. Thank you for your comment. You are welcome :)

      Delete
  3. Hello Davide, do you have an example of running text/scrol up text for 8x8 led matrix ? Thanks

    ReplyDelete
    Replies
    1. Hello, no unlucky I have no example for that, you have it to code by yourself. If you do this, and would like to share that code you can post your gist or pastebin code link here, it would be usefull for other people maybe.

      Delete
  4. Hello David,
    I just try your code, however I received error below:

    c:/program files/atmel/avr tools/avr toolchain/bin/../lib/gcc/avr/4.4.3/../../../../avr/bin/ld.exe: cannot find -l_max7219_01\david_avr_lib_max7219_01
    make: *** [david_avr_lib_max7219_01.elf] Error 1
    Build failed with 1 errors and 0 warnings...

    I have AVR4.18 Build 716 SP3, Toolchain 3.0.0.240Win32

    Please help,
    Karen

    ReplyDelete
    Replies
    1. Hello, you have to link all the code needed. You can find a few information about avrgcc compiling on avrfreaks forum

      Delete