Hi all,
I bougth this
[http://www.ebay.es/itm/5V-MAX7219-8-Digit-Display-Rojo-LED-Modulo-7-Segmentos-Tubo-Digital-para-Ard
uino-/400746071949?pt=LH_DefaultDomain_186&hash=item5d4e53c78d](http://www.ebay.es/itm/5V-MAX7219-8-Digit-Display-Rojo-LED-Modulo-7-Segmentos-Tubo-Digital-para-Ard) 8 x 7 segments MAX7219 based
display. I have it wired like "picture1" and try to make it work with this software
/* code for max 7219 from maxim,
reduced and optimised for useing more then one 7219 in a row,
______________________________________
/* ORIGONAL COMMENTS SUPRESSED TO MAKE IT FIT ON THE FORUM (vffgaston 14/11/14)*/
int dataIn = 2;
int load = 3;
int clock = 4;
int maxInUse = 1; //change this variable to set how many MAX7219's you'll use
int e = 0; // just a varialble
// define max7219 registers
byte max7219_reg_noop = 0x00;
byte max7219_reg_digit0 = 0x01;
byte max7219_reg_digit1 = 0x02;
byte max7219_reg_digit2 = 0x03;
byte max7219_reg_digit3 = 0x04;
byte max7219_reg_digit4 = 0x05;
byte max7219_reg_digit5 = 0x06;
byte max7219_reg_digit6 = 0x07;
byte max7219_reg_digit7 = 0x08;
byte max7219_reg_decodeMode = 0x09;
byte max7219_reg_intensity = 0x0a;
byte max7219_reg_scanLimit = 0x0b;
byte max7219_reg_shutdown = 0x0c;
byte max7219_reg_displayTest = 0x0f;
void putByte(byte data) {
byte i = 8;
byte mask;
while(i > 0) {
mask = 0x01 << (i - 1); // get bitmask
digitalWrite( clock, LOW); // tick
if (data & mask){ // choose bit
digitalWrite(dataIn, HIGH);// send 1
}else{
digitalWrite(dataIn, LOW); // send 0
}
digitalWrite(clock, HIGH); // tock
--i; // move to lesser bit
}
}
void maxSingle( byte reg, byte col) {
//maxSingle is the "easy" function to use for a //single max7219
digitalWrite(load, LOW); // begin
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
digitalWrite(load, LOW); // and load da shit
digitalWrite(load,HIGH);
}
void maxAll (byte reg, byte col) { // initialize all MAX7219's in the system
int c = 0;
digitalWrite(load, LOW); // begin
for ( c =1; c<= maxInUse; c++) {
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
}
digitalWrite(load, LOW);
digitalWrite(load,HIGH);
}
void maxOne(byte maxNr, byte reg, byte col) {
//maxOne is for adressing different MAX7219's,
//whilele having a couple of them cascaded
int c = 0;
digitalWrite(load, LOW); // begin
for ( c = maxInUse; c > maxNr; c--) {
putByte(0); // means no operation
putByte(0); // means no operation
}
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
for ( c =maxNr-1; c >= 1; c--) {
putByte(0); // means no operation
putByte(0); // means no operation
}
digitalWrite(load, LOW); // and load da shit
digitalWrite(load,HIGH);
}
void setup () {
pinMode(dataIn, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(load, OUTPUT);
//beginSerial(9600);
digitalWrite(13, HIGH);
//initiation of the max 7219
maxAll(max7219_reg_scanLimit, 0x07);
maxAll(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits)
maxAll(max7219_reg_shutdown, 0x01); // not in shutdown mode
maxAll(max7219_reg_displayTest, 0x00); // no display test
for (e=1; e<=8; e++) { // empty registers, turn all LEDs off
maxAll(e,0);
}
maxAll(max7219_reg_intensity, 0x0f & 0x0f); // the first 0x0f is the value you can set
// range: 0x00 to 0x0f
}
void loop () {
//if you use just one MAX7219 it should look like this
/*
maxSingle(1,1); // + - - - - - - -
maxSingle(2,2); // - + - - - - - -
maxSingle(3,4); // - - + - - - - -
maxSingle(4,8); // - - - + - - - -
maxSingle(5,16); // - - - - + - - -
maxSingle(6,32); // - - - - - + - -
maxSingle(7,64); // - - - - - - + -
maxSingle(8,128); // - - - - - - - +
*/
//if you use more than one MAX7219, it should look like this
/*
maxAll(1,1); // + - - - - - - -
maxAll(2,3); // + + - - - - - -
maxAll(3,7); // + + + - - - - -
maxAll(4,15); // + + + + - - - -
maxAll(5,31); // + + + + + - - -
maxAll(6,63); // + + + + + + - -
maxAll(7,127); // + + + + + + + -
maxAll(8,255); // + + + + + + + +
*/
//
//if you use more then one max7219 the second one should look like this
maxOne(2,1,1); // + - - - - - - -
maxOne(2,2,2); // - + - - - - - -
maxOne(2,3,4); // - - + - - - - -
maxOne(2,4,8); // - - - + - - - -
maxOne(2,5,16); // - - - - + - - -
maxOne(2,6,32); // - - - - - + - -
maxOne(2,7,64); // - - - - - - + -
maxOne(2,8,128); // - - - - - - - +
//
delay(2000);
}
No way (I know it is not for 7 segments, but I guess it should make LEDs lit in some definite
pattern: it either set all LED's on -most of the times- or off: no further functioning).
Then, after rewiring to pins 12, 11 & 10, I tried this software (which is specific for 7 segment pattern)
//We always have to include the library
#include "LedControl.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,11,10,1);
/* we always wait a bit between updates of the display */
unsigned long delaytime=250;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
/*
This method will display the characters for the
word "Arduino" one after the other on digit 0.
*/
void writeArduinoOn7Segment() {
lc.setChar(0,0,'a',false);
delay(delaytime);
lc.setRow(0,0,0x05);
delay(delaytime);
lc.setChar(0,0,'d',false);
delay(delaytime);
lc.setRow(0,0,0x1c);
delay(delaytime);
lc.setRow(0,0,B00010000);
delay(delaytime);
lc.setRow(0,0,0x15);
delay(delaytime);
lc.setRow(0,0,0x1D);
delay(delaytime);
lc.clearDisplay(0);
delay(delaytime);
}
/*
This method will scroll all the hexa-decimal
numbers and letters on the display. You will need at least
four 7-Segment digits. otherwise it won't really look that good.
*/
void scrollDigits() {
for(int i=0;i<13;i++) {
lc.setDigit(0,3,i,false);
lc.setDigit(0,2,i+1,false);
lc.setDigit(0,1,i+2,false);
lc.setDigit(0,0,i+3,false);
delay(delaytime);
}
lc.clearDisplay(0);
delay(delaytime);
}
void loop() {
writeArduinoOn7Segment();
scrollDigits();
}
without success too . . . .(off all the time)
Any idea?
Thanks
(I feel like a noob: Before the #@@ñ#é@##· (f...d, I mean) maintenance weeks ago I was able to
search through the forum by typing the "keywords"; then the related trheads appeared. Now it drives
me to the "google results like" page. I am sorry opening a new trhead -I feel like increasing
universe entropy with no necessity- but I dont know how to find a valuable trhead)
(Picture2 is of the same 7x8 display)

