Chipkit Uno and 8×8 LED Matrix

The MAX7219 is a 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 slew-rate-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 code-B decoding or no-decode for each digit.

Typically you can buy 8×8 LED matrix modules which use the MAX7219, here is a picture of one of these modules

I wired the module as follows

Max7219 CLK = 6
Max7219 CS = 5
Max7219 DIN = 7

VCC was connected to 5v and Gnd to an available GND pin

Code

You need to install the LedControl library – http://playground.arduino.cc/Main/LedControl

[codesyntax lang=”cpp”]

#include "LedControl.h"

/*
Max7219_pinCLK = 6;
Max7219_pinCS = 5;
Max7219_pinDIN = 7;
*/
LedControl lc=LedControl(7,6,5,1);

unsigned char i;
unsigned char j;
unsigned long delaytime=100;

void setup()
{
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}

void single() 
{
  for(int row=0;row<8;row++)
  {
    for(int col=0;col<8;col++)
    {
      delay(delaytime);
      lc.setLed(0,row,col,true);
      delay(delaytime);
      for(int i=0;i<col;i++)
      {
        lc.setLed(0,row,col,false);
        delay(delaytime);
        lc.setLed(0,row,col,true);
         delay(delaytime);
      }
    }
  }
}

void loop()
{
  single();
  lc.clearDisplay(0);
}

[/codesyntax]

 

Links
chipKIT Uno32

Sunkee MAX7219 Dot matrix module MCU control Display module DIY kit for Arduino

Related posts

Chipkit Max32 and ADXL335 accelerometer example

Chipkit Max32 and LSM303 Accelerometer example

Chipkit Max32 and LSM303 Magnetometer example

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More