Need Help with MAX7219 driver for 7 segment diplay

anyone worked with max7219 on SPI??

someone can help mee? :((( plz

We all can help but what is your question? :slight_smile:

You asked if anyone worked with MAX7219 and I assume no one did…but you can specific help on your needs and then you get a lot of answers.

That chip looks pretty straight forward… What do you need?

I use SPI a hell of a lot. Do you need a driver? As I dont think there is one at the moment…

Cheers Ian

yes i need driver to write some numbers in 7segment display but i’m working with this already one week but i have not any success,
i have this display build on max7219 driver

This digit display has the MAX controller on the back?!

Here is the code on how to use MAX7219:

http://blogs.msdn.com/b/coding4fun/archive/2010/12/13/10104241.aspx

They chose to use “bitbang” method, because:

yes this digit has max7219 back, tomorrow i will take photo on my device and i’ll upload it.

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using System.Collections;
namespace LEDMatrix8_8
{
public class Program
{
public static SPI spi;
public static OutputPort CS_RS = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di9, false);
//กาหนดเอาพุตพอร์ตเป็นพิน Di9
public static byte[] off = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//ดับทั้งหมด
public static byte[] A = { 0x00, 0x00, 0x7C, 0x7E, 0x13, 0x13, 0x7E, 0x7C, 0x00 }; //A
public static byte[] B = { 0x00, 0x41, 0x7F, 0x7F, 0x49, 0x49, 0x7F, 0x36, 0x00 }; //B
public static byte[] C = { 0x00, 0x1C, 0x3E, 0x63, 0x41, 0x41, 0x63, 0x22, 0x00 }; //C
public static byte[] D = { 0x00, 0x41, 0x7F, 0x7F, 0x41, 0x63, 0x3E, 0x1C, 0x00 }; //D
public static byte[] E = { 0x00, 0x41, 0x7F, 0x7F, 0x49, 0x5D, 0x41, 0x63, 0x00 }; //E
public static byte[] F = { 0x00, 0x41, 0x7F, 0x7F, 0x49, 0x1D, 0x01, 0x03, 0x00 }; //F
public static byte[] G = { 0x00, 0x1C, 0x3E, 0x63, 0x41, 0x51, 0x73, 0x72, 0x00 }; //G
public static byte[] H = { 0x00, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00 }; //H
public static byte[] I = { 0x00, 0x00, 0x41, 0x41, 0x7F, 0x7F, 0x41, 0x41, 0x00 }; //I
Drive Matrix LED 8*8
public static byte[] J = { 0x00, 0x30, 0x70, 0x40, 0x41, 0x7F, 0x3F, 0x01, 0x00 }; //J
public static byte[] K = { 0x00, 0x41, 0x7F, 0x7F, 0x08, 0x1C, 0x77, 0x63, 0x00 }; //K
public static byte[] L = { 0x00, 0x41, 0x7F, 0x7F, 0x41, 0x40, 0x60, 0x70, 0x00 }; //L
public static byte[] M = { 0x00, 0x7F, 0x7F, 0x0E, 0x1C, 0x0E, 0x7F, 0x7F, 0x00 }; //M
public static byte[] N = { 0x00, 0x7F, 0x7F, 0x06, 0x0C, 0x18, 0x7F, 0x7F, 0x00 }; //N
public static byte[] O = { 0x00, 0x1C, 0x3E, 0x63, 0x41, 0x63, 0x3E, 0x1C, 0x00 }; //O
public static byte[] P = { 0x00, 0x41, 0x7F, 0x7F, 0x49, 0x09, 0x0F, 0x06, 0x00 }; //P
public static byte[] Q = { 0x00, 0x1E, 0x3F, 0x21, 0x71, 0x7F, 0x5E, 0x00, 0x00 }; //Q
public static byte[] R = { 0x00, 0x41, 0x7F, 0x7F, 0x09, 0x19, 0x7F, 0x66, 0x00 }; //R
public static byte[] S = { 0x00, 0x26, 0x6F, 0x4D, 0x59, 0x73, 0x32, 0x00, 0x00 }; //S
public static byte[] T = { 0x00, 0x03, 0x41, 0x7F, 0x7F, 0x41, 0x03, 0x00, 0x00 }; //T
public static byte[] U = { 0x00, 0x7F, 0x7F, 0x40, 0x40, 0x7F, 0x7F, 0x00, 0x00 }; //U
public static byte[] V = { 0x00, 0x1F, 0x3F, 0x60, 0x60, 0x3F, 0x1F, 0x00, 0x00 }; //V
public static byte[] W = { 0x00, 0x7F, 0x7F, 0x30, 0x18, 0x30, 0x7F, 0x7F, 0x00 }; //W
public static byte[] X = { 0x00, 0x43, 0x67, 0x3C, 0x18, 0x3C, 0x67, 0x43, 0x00 }; //X
public static byte[] Y = { 0x00, 0x07, 0x4F, 0x78, 0x78, 0x4F, 0x07, 0x00, 0x00 }; //Y
public static byte[] Z = { 0x00, 0x47, 0x63, 0x71, 0x59, 0x4D, 0x67, 0x73, 0x00 }; //Z
public static byte[] heart = { 0x00, 0x0E, 0x1F, 0x3F, 0x7E, 0x7E, 0x3F, 0x1F, 0x0E };
//รูปหัวใจ
public static byte[] ba = new byte[1];// ให้ ตัวแปร ba เป็น Byte
public static OutputPort RS = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, true);
//กาหนดเอาพุตท์พอร์ต LED
public static void Main()
{
SPI.Configuration MyConfig = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di8, false, 10, 10, false, true, 1000, SPI.SPI_module.SPI1);
//กาหนดค่า SPI config ให้อุปกรณ์
spi = new SPI(MyConfig);
RS.Write(false);
mywrite(0x0A, 0x0A); //ความสว่าง
mywrite(0x0B, 0x07); // Display refresh
mywrite(0x0C, 0x01); // Turn on the display
mywrite(0x0F, 0x01); // display
mywrite(0x09, 0x00); //no decode
Thread.Sleep(1000); //ให้ดีเลย์ เท่ากับ 1000
mywrite(0x0F, 0x00); // display
while (true)
{
Show();
}//กาหนดให้แสดงผลตามฟังชันก์ Show
}
public static void shiftOut(byte b)
{
ba[0] = b;
spi.Write(ba);
}//กาหนดการทางานในการเขียน Byte
static public void mywrite(byte b1, byte b2)
{
CS_RS.Write(false);//Select OutputPort
shiftOut(b1); //ส่งค่าคอลัมน์ให้กับ MAX7219
shiftOut(b2); //ส่งค่ามูลค่าให้กับ MAX7219
CS_RS.Write(true);//Deselect OutputPort
}
public static void Show()
{
for (byte i = 1; i <= 8; i++){mywrite(i, off[i]);}//ดับทั้งหมด
Thread.Sleep(1000); //ให้ดีเลย์ เท่ากับ 1000
for (byte i = 1; i <= 8; i++) { mywrite(i, A[i]); }//A
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, B[i]); }//B
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, C[i]); }//C
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, D[i]); }//D
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, E[i]); }//E
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, F[i]); }//F
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, G[i]); }//G
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, H[i]); }//H
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, I[i]); }//I
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, J[i]); }//J
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, K[i]); }//K
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, L[i]); }//L
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, M[i]); }//M
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, N[i]); }//N
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, O[i]); }//O
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, P[i]); }//P
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, Q[i]); }//Q
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, R[i]); }//R
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, S[i]); }//S
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, T[i]); }//T
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, U[i]); }//U
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, V[i]); }//V
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, W[i]); }//W
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, X[i]); }//X
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, Y[i]); }//Y
Thread.Sleep(1000);
for (byte i = 1; i <= 8; i++) { mywrite(i, Z[i]); }//Z
Thread.Sleep(1000);
}
}
}

@ woraphon - What are you trying to say?

I assume he’s demonstrating how to use the max7219 to talk to a 8x8 dot matrix display. The link on his profile seems to go to a Thai university project site.

@ hagster Looks like it.