Go Down

Topic: Max7219 all digits display the same? (Read 196 times) previous topic - next topic

xSPARExSTEWx

I am using a atmega328p and a max7219. I have the LEDControl library and it is just not working correctly. I was getting weird results with this and I decided to go to the basics and just have the 2 chips and the 7 segment display. I am using the LCDemo7Segment sketch for testing and all the digits are displaying the same thing at the same time. I am pretty sure I have the wires connected correctly. Display 1 (far left) to pin 2 (DIG 0), Display 2 to pin 11 (DIG 1), etc. I have a 4 display 7 segment display connected to it.


Any ideas or am I just missing something?

Paul__B

Any ideas or am I just missing something?
Yes, revealing your code according to the posting instructions!

xSPARExSTEWx

#2
Dec 11, 2018, 12:08 am Last Edit: Dec 11, 2018, 09:44 pm by xSPARExSTEWx
Did not know I needed to add it as it is an example. I have only changed the pins for my configuration.

Code: [Select]
//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 6 is connected to the DataIn
pin 7 is connected to the CLK
pin 8 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(6,7,8,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();
}

Paul__B

Oh dear!  Didn't read the instructions!   :smiley-eek:

xSPARExSTEWx

#4
Dec 11, 2018, 09:55 pm Last Edit: Dec 11, 2018, 10:00 pm by xSPARExSTEWx
It was not mentioned in the instructions. I was taking a guess and trying to save some space and everyone's time as it is an example.

I still need help. I just redid my wiring and it was correct. I have tried different pins and no luck.Both of my max7219s are doing this. I have tried using a atmega328 and arduino mega 2560. The videos online show a very different display than mine. I have no clue why this is happening. Only thing that is off from other sources is that there should be a resistor between 5v and ISET. When anything is connected to ISET everything stays on and looks like the code is not running, but right as it is removed I get the same problem. I am using a 10k as that is what is recommended.

xSPARExSTEWx

I got it figured out if anyone else has this problem. I accidently ordered a common anode display instead of a common cathode.

This should help.

https://forum.arduino.cc/index.php?topic=121174.0

Paul__B

Ah!  Didn't describe the problem correctly!

"all digits display the same" was indeed the case, but the real description was "all segments continuously lit without any code running".

Had you said that, we would have deciphered it immediately.

Go Up