LED display knowhow?

Hi. I am using an UNO R3 and a MAX7219 8 Digit Seven Segment Display Module (HCMODU0082) from HobbyComponents. The libraries are available on their page and some example sketches. Here:
Hmmm, Insert Hyperlink doesn’t work?

http://forum.hobbycomponents.com/viewtopic.php?f=58&t=1794

What I’m trying to achieve for starters, is just to write HELLO !! on the display as suggested in their code. It doesn’t work…

/* Include the HCMAX7219 and SPI library */
#include <HCMAX7219.h>
#include "SPI.h"

/* Set the LOAD (CS) digital pin number*/
#define LOAD 10
 
/* Create an instance of the library */
HCMAX7219 HCMAX7219(LOAD);

void setup() 
{
  HCMAX7219.Init();        
}

/* Main program */
void loop() 
{
  /* Clear the output buffer */
  HCMAX7219.Clear();
  /* Write some text to the output buffer */
  HCMAX7219.print7Seg("HELLO !!",8);
  /* Send the output buffer to the display */
  HCMAX7219.Refresh();  
  
  while(1);

}

They also have a scrolling text sketch example that does work but Im less interested in that. Can anybody see why it’s broken please?

Insert Hyperlink doesn’t work?

Oh yes it does

http://forum.hobbycomponents.com/viewtopic.php?f=58&t=1794

It doesn’t work…

You gave no indication of what happens when you run the program

 HCMAX7219.print7Seg("HELLO !!",8);

Did you mean to print starting at position 8 ?

OK, so Insert Hyperlink likes you better.

The code compiles and then does nothing. Absolutely nothing. I run a similar code with a couple more bits n bobs in it and it runs…

/* Include the HCMAX7219 and SPI library */
#include <HCMAX7219.h>
#include "SPI.h"

/* Set the LOAD (CS) digital pin number*/
#define LOAD 10
 
/* Create an instance of the library */
HCMAX7219 HCMAX7219(LOAD);


void setup() 
{
  HCMAX7219.Init();        
}

/* Main program */
void loop() 
{
  byte Loopcounter;
  byte Position;
  
  /* SCROLL SOME TEXT 5 TIMES BEFORE MOVING ON */
  for (Loopcounter = 0; Loopcounter <= 5; Loopcounter++)
  {
    /* We are scrolling 30 characters of text across the entire display */
    for (Position = 0; Position <= DISPLAYBUFFERSIZE + 30; Position++)
    { 
      /* Write the test to the output buffer at the position we require */
      HCMAX7219.print7Seg("HCMAX7219 SCROLLING TEXT DEMO ",Position);
      /* Send the output buffer to the display */
      HCMAX7219.Refresh();  
      delay(200);
    }
  }
  
  
  /* WE CAN ALSO DISPLAY INTEGER NUMBERS */
  
  /* Clear the output buffer */
  HCMAX7219.Clear();
  /* Write some text and output it*/
  HCMAX7219.print7Seg("INT NUM.",8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* display an example of a negative integer number */
  HCMAX7219.Clear();
  HCMAX7219.print7Seg(-1234567,8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* Clear the output buffer */ 
  HCMAX7219.Clear();
  /* Write some text and output it*/
  HCMAX7219.print7Seg("WITH DP.",8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* Show the DP in different places. Notice when the DP is at the 
    beginning the number is padded with a zero */
  HCMAX7219.Clear();
  for (Position = 1; Position <= 7; Position++)
  { 
    HCMAX7219.print7Seg(-1234567,Position,8);
    HCMAX7219.Refresh();
    delay(1000);
  }
}

Basically produces some gibberish at the end, but runs anyway.

I did not mean to print starting at position 8 (I didn’t write the code, got it as an example…) and as they do not comment on it, it seemed that it was an indicator of the amount of segments to write over?

I Actually just want a bit of code that writes something to the display the moment I turn it on but I’m not familiar with displays yet, let alone LED’s. Can you help?

Just to be clear. The scrolling text example on the sire works but the static text example doesn’t. Is that correct ?

Just for amusement can you try setting the second parameter in print7Seg() to 1 in the static text example

Nope, 1, zero, 2 etc. No result. I understand why they Clear() the display but not sure why they refresh it after it renders? Also, the line; while(1), I don't get?

Yes, the code for scrolling text works (2nd example). I stripped it down to just one line of display and it runs it perfectly in a loop…
As soon as I remove the code to loop, it stops.

 for (Loopcounter = 0; Loopcounter <= 5; Loopcounter++)
  {
    /* We are scrolling 30 characters of text across the entire display */
    for (Position = 0; Position <= DISPLAYBUFFERSIZE + 30; Position++)
    {

This leaves me with:

HCMAX7219.print7Seg("HCMAX7219 SCROLLING TEXT DEMO ",Position);
      /* Send the output buffer to the display */
      HCMAX7219.Refresh();

and that looks the same as their first example except for “Position” for the increment in segment position. Replacing that with zero or 1 should work? I am missing something simple.

Replacing that with zero or 1 should work?

That's the way it looks to me.

Replace Position in the call to Refresh in the scrolling code with a 1 as you alluded to. The for loop is not necessary but can stay there for now.

Also, the line; while(1), I don't get?

That causes the program to repeat that line forever, ie stop updating the display

  /* Clear the output buffer */
  HCMAX7219.Clear();
  /* Write some text to the output buffer */
  HCMAX7219.print7Seg("HELLO !!",8);
  /* Send the output buffer to the display */
  HCMAX7219.Refresh();

The comments above the function calls tell you what they are doing.