MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

LCD, TFT, OLED, LED modules
andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andrew » Tue Jul 19, 2016 9:22 am

You could simply pad the value with a zero if it's less than 10. Here is an (untested) example:

Code: Select all

void loop() 
{
  for(byte Seconds = 0; Seconds < 60; Seconds++)
  {
    Disp2DigNum(Seconds, 8);

    HCMAX7219.Refresh();  
    delay(1000);
  }
}


void Disp2DigNum(int Number, byte Pos)
{
  if(Number < 10)
  {
    HCMAX7219.print7Seg((long)0, Pos);
    HCMAX7219.print7Seg(Number, --Pos);
  }else
  {
    HCMAX7219.print7Seg(Number, Pos);
  }
}
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

barberp
Posts: 1
Joined: Thu Apr 30, 2015 2:17 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by barberp » Tue Jun 13, 2017 9:31 am

I have used 9 of these succesfully with the library and an Uno, the following may help if anyone is considering this to avoid spurious characters and inconsistencies which cause me a few headaches;

Do not daisy chain the Vcc and earth lines futher than 2 modules - supply power to both sides of each module.
Use a capacitor (I used 1000ufd) to decouple power near the chain.
Be aware of the current required >1.5A depending on what is displayed - this needs to be from an external supply not the Uno.
Set the number of drives in the header file - note drive 1 will be the last in the chain.

Other than that these work really well with no flicker during update and a very consistent display :-), thanks again for good quality components and a nice library.

BenC
Posts: 2
Joined: Fri Jan 19, 2018 6:35 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by BenC » Fri Jan 19, 2018 6:47 pm

I have 2 modules linked as a counter and rate meter but the second one shows glitches and then the first one crashes showing all 8s. Have tried capacitors but no improvement. Seems to work better when the parts and wires are spread out but I need it all in a small enclosure. Do they work with the nano as thinking of using one on each as one module seems fine.

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andrew » Mon Jan 22, 2018 9:37 am

It sounds like either the clock or data is getting corrupted for some reason. I'd check the wires and connection. Especially make sure the 5V and GND connections are good. Also if any of the wires are quite long this could cause a problem.
Do they work with the nano as thinking of using one on each as one module seems fine.
Yes the Nano uses a ATMega328 just like the Uno so will function exactly the same.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

BenC
Posts: 2
Joined: Fri Jan 19, 2018 6:35 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by BenC » Mon Jan 22, 2018 1:39 pm

Many thanks Andrew, I tried them again today on a different UNO and it worked fine so I plugged back into the original one and still OK so was probably a bad connection somewhere.

DIY_Monster
Posts: 12
Joined: Thu Nov 20, 2014 3:35 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by DIY_Monster » Wed Aug 29, 2018 10:36 pm

Hello, I'm using Arduino ver 1.8.5 under Linux 18.04. Version 4 of the 7219 driver would not display all of the cycles in the example files but version 3 did and this is the version I am using at the moment for development. I am attempting to use one of the external interrupts (pins2 or 3) and then display some timing info on the 8 digit 7-seg display. However, I have found that I can not do both. I have pared away the code that reveals the problem.

// **************************start ************************
#include <HCMAX7219.h>
#include "SPI.h"
#define LOAD 10 /* Set the LOAD (CS) digital pin number*/
HCMAX7219 HCMAX7219(LOAD);/* Create an instance of the library */
int inPin = 3; // 2 or 3
boolean PinState = 1;

void setup()
{
pinMode(inPin, INPUT);
pinMode(13, OUTPUT); // onboard led
attachInterrupt(digitalPinToInterrupt(inPin), RPMCount, RISING);
//HCMAX7219.Init(); // init 7seg display, this line stops the ISR <-------- HERE---------
}
void loop()
{
}
void RPMCount()
{
PinState = !PinState;
digitalWrite(13, PinState); // toggle led
}
// **************************end ************************

This code above will work fine. The LED attached to D13 will toggle each time pin D3 sees an edge. However when I add HCMAX7219.Init(); to setup(), the toggle LED instruction in the ISR is no longer executed leading me to believe that the interrupt is no longer working. This is the case with Pin 2 or 3. I have read in several places the the drivers for this display nor the SPI() drivers use Int.0 or Int.1 in a way that should interfere and yet is seems to. Please could an explanation be offered? Many thanks.

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by andrew » Thu Aug 30, 2018 9:11 am

Pin 13, the pin you're using for the LED is required by the HCMAX7219 library for the SPI clock function. This is probably the issue. Try changing this pin to one that's not in use by the library (e.g. pin 7). You will of course need to attach something to that pin to see it toggle.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Phil-S
Posts: 7
Joined: Wed Jan 30, 2019 10:17 am

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by Phil-S » Wed Jan 30, 2019 10:48 am

Hello
I have a couple of these modules bought very recently and am now working through examples etc. and your library.
I tried displaying some decimal values using the HCMAX7219.print7Seg(Value, DP, Digits, Offset) method, but it throws up an error. Going through the h and cpp files (downloaded 29jan2019 from your repository at github) and noticed that the function only takes 3 arguments, not 4, hence the error. Which is correct?
The other problem I am having is the way an incrementing count, say 0 to 9999, is filling the digits. I'm used to seeing digits filling the units in rightmost display, then 10's in the second from the left and so on.
What I am seeing is the units filling the digit set by OFFSET, then 10's filling the OFFSET digit, shoving the units right, then this being repeated until 9999 is displayed with the thousands at digit 7, hundreds at digit 6, tens at digit 5 and units at digit 4 (digit 8 is the leftmost).
I hope this is understandable.
How do I, if possible, set it up so that units stay at digit 1, 10's in digit 2, 100's in digit 3 and 1000's in digit 4?
Eventually, I want to count pulses up to 99999999.
Thanks

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by andrew » Wed Jan 30, 2019 3:38 pm

The library on github is out of date. You can download the latest (V0.5) from the software section of our support forum here:

http://forum.hobbycomponents.com/viewto ... =58&t=1794


This version includes a variation of the print7Seg() function which gives more control of how numbers are displayed:

  1. HCMAX7219.print7Seg(Value, DP, Digits, Offset)
Where:

Value is the number you wish to print

DP specifies the number of decimal places to display the number to.

Digits is the total number of digits to display. If the number is smaller than the specified number of digits it will pad
the left side of the number with spaces.

Offset is the column position from where the value will start from. Valid values are from 0 to 65535 (Uno/Nano etc) where:
1 = right most column
8 = left most column


So for you example if you have a single 8 digit module and you want to display a increment from 0 to 9999 starting at the right most side of the display you would set Digits to 4 and offset to 4. Like this:

  1. HCMAX7219.print7Seg(Value, 0, 4, 4)
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Phil-S
Posts: 7
Joined: Wed Jan 30, 2019 10:17 am

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by Phil-S » Tue Feb 19, 2019 9:11 pm

Hello
Just a thought on the PCB design if it comes up for a revision.
It would be helpful for hard-wiring the board in if all the pins (headers and displays) were on 0.1" pitch.
The displays are, but the headers aren't.
Also, if possible, supply the headers unsoldered to allow pins above or below the board.
Personally, I would like to see the displays soldered straight onto the board, not inserted into sockets. The turned pin sockets can result in an untidy display.
I'm using the modules on a FR4 PTH prototyping board with a Nano and increment and reset buttons to count the Whr pulses on an electricity meter that I don't trust. I tot up about 15000 counts per 24-hrs and reset the the count to zero at midday. The meter LCD in kWhrs is always more than the 1-pulse per Whr LED on the meter by about 5%.
Naughty supplier

Post Reply