Try to follow this tutorial to see 4567 on the display unit. This is a test sketch. You can then use the LedControl.h Library.
1. Connect your display unit as follows with Arduino UNO using SPI Port.
UNO Display Module
5V Vcc
GND GND
10 (ss) CS
11 (MOSI) DI
13 (SCK) CLK
2. Upload the following sketch.
#include<SPI.h>
byte registerAddress[] = {0x0C, 0x09, 0x0A, 0x0B}; //control registers of MAX7219, see data sheets
byte registerData[] = {0x01, 0x00, 0x01, 0x07};
//normal modeo; no-decode;intensity;8-digit scan
byte dataArray[8]; //to hold cc-codes (no-decode format)
byte digitAddress[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};//DP0-DP7
byte lupTable[] = {0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70,
0x7F, 0x7B, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47
}; //0, 1, ...., E, F ; no-decode cc-code see data sheets
void setup()
{
pinMode(10, OUTPUT); //LOAD Pin of MAX7219
//-------------------
SPI.begin();
// bitSet(SPCR, 4); //UNO is Master SPI
// SPI.setBitOrder(MSBFIRST); //MSB_bit will be transferred first
SPI.setClockDivider(SPI_CLOCK_DIV128); //TX rate = 16MHz/128 = 125 kbit
// SPI.setDataMode(SPI_MODE1);//MOSI is sampled at the rising edge of CLK
//------------------------------------------------
digitalWrite(10, LOW); //Low at LOAD pin
//---- dataArray update-----------------------------
dataArray[0] = lupTable[4]; //no-decode cc-code of digit-4
dataArray[1] = lupTable[5]; //n0-decode cc-code of digit-5
dataArray[2] = lupTable[6]; //no-decode cc-code of digit-6
dataArray[3] = lupTable[7]; //no-decode cc-code of digit-7
//-------------------------------------------------
//---keep intializing the Mode of Operation------------
for (int i = 0; i < 4; i++)
{
SPI.transfer(registerAddress[i]);
SPI.transfer(registerData[i]);
digitalWrite(10, LOW);
digitalWrite(10, HIGH); //assert LH/LL on LOAD pin
digitalWrite(10, LOW);
}
//--keep transferring the result/data----------------------
for (int i = 0; i < 4; i++)
{
SPI.transfer(digitAddress[i]); //DPX position
SPI.transfer(dataArray[i]); //shows 4 5 6 7 on display
digitalWrite(10, LOW);
digitalWrite(10, HIGH); //assert LH/LL on LOAD pin
digitalWrite(10, LOW);
}
}
void loop()
{
}
3. Check that 4567 has appeared on the display module.