Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Wiring Hardware >> Tangible computing >> Max7219 + Tutorials ... still doesn't work
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1210267839

Message started by julienb on 05/08/08 at 17:30:39

Title: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/08/08 at 17:30:39
I tested this tut during 3 h.
http://www.arduino.cc/playground/Main/MAX72XXHardware

I used this code:
http://www.arduino.cc/playground/LEDMatrix/Max7219

of course I modified this code with:
- the right number of max7219,
- the right Dout pins of my Wiring board.

it should work, it doesn't...!  :'(

any experiencies ? ideas ?


my code:
I put the Serial stuff at the end in order to watch the loop running.


int dataIn = 5;
int load = 6;
int clock = 7;

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);



//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 () {
 Serial.begin(9600);
 Serial.println("okk");

  maxSingle(1,4);                      
  maxSingle(2,2);
 delay(2000);
  maxSingle(1,0);
  maxSingle(2,0);
}

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/10/08 at 19:05:42
can this LedControl library from arduino can work with Wiring ?
http://www.arduino.cc/playground/Main/LedControl

I cannot make it works ...      :'(


what do you advice as library for led for max72XX?

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by barragan on 05/10/08 at 19:23:19
hey are you running this on an arduino or Wiring board?

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/10/08 at 19:27:39
Wiring

I'm despaired ..
I'm just looking for a library in order to make:
function(x,y,HIGH)


http://www.arduino.cc/playground/LEDMatrix/Max7219 is exactly that..
but don't work with ... wiring  :'(


Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/10/08 at 19:51:00
barragan, could you help me? (or ..save me ?)  :D

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by barragan on 05/10/08 at 22:07:02
Why not to use the Matrix library? it is much simpler, see this example: http://wiring.org.co/learning/examples/hello_matrix.html

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/11/08 at 08:13:04
hello barragan,

I won't use this sparkfun matrix, but the one with PCB Board + Button Pads.

for the moment, I only have a 4x2 leds matrix.
the library you adviced me doesn't work with 7221
with my 7219, it doesn't seem to work fine...
BUT indeed, I only have 4x2. Maybe, it doesn't dissipate current enough, and I don't see the results ....?

barragan, can you advice me a library for 8x8 leds matrix useable with Wiring?

thanks a lot!!

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/11/08 at 10:27:56
on this schematic, is there THE row/column mistake? is there the column mistake (DP A B C D instead of DP G F E etc) ?
http://www.arduino.cc/playground/uploads/Main/MAX72XX_Schematic.jpg

I'm stuck!

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by barragan on 05/11/08 at 16:22:16
The Wiring Matrix library works fine for both chips, we used recently in a workshop, it not only works with sparkfun products, people brought different matrix types, sizes etc, and w were able to use them with no problem. The only thing wasw to find out if pins were compatible that as it, some changes in the wires have to be done to fit specific matrix needs.

Title: Re: Max7219 + Tutorials ... still doesn't work
Post by julienb on 05/11/08 at 16:25:09
here too!
no problem, barragan.

My stupid code was buggy!

Now, next step: making max & Wiring board talks !!

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.