In this example, we will use the chipKIT Uno32 board and connect this to a MAX7219-driven 8-digit seven segment LED display.
The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors (µPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM that stores each digit. Only one external resistor is required to set the segment current for all LEDs.
The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and has slewrate-limited segment drivers to reduce EMI.
A convenient 4-wire serial interface connects to all common µPs. Individual digits may be addressed and updated without rewriting the entire display. The MAX7219/MAX7221 also allow the user to select codeB decoding or no-decode for each digit.
Here is a picture of the module used
Code
You will need the LedControl library – http://wayoda.github.io/LedControl/pages/software.html
[codesyntax lang=”cpp”]
#include "LedControl.h" /* Now we need a LedControl to work with. ***** These pin numbers will probably not work with your hardware ***** pin 7 is connected to the DataIn pin 6 is connected to the CLK pin 5 is connected to LOAD We have only a single MAX72XX. */ LedControl mydisplay=LedControl(7,6,5,1); void setup() { mydisplay.shutdown(0, false); // turns on display mydisplay.setIntensity(0, 15); // 15 = brightest mydisplay.setDigit(0, 0, 9, false); mydisplay.setDigit(0, 1, 8, false); mydisplay.setDigit(0, 2, 7, false); mydisplay.setDigit(0, 3, 6, false); mydisplay.setDigit(0, 4, 5, true); mydisplay.setDigit(0, 5, 4, false); mydisplay.setDigit(0, 6, 3, false); mydisplay.setDigit(0, 7, 2, false); } void loop() { }
[/codesyntax]
Links
MAX7219 8-Digit LED Display Module Digital Tube for Arduino SPI Control