modify this code to make a one second timer using the MAX7219

This code and the MAX7219 work very well. The problem is that it counts to fast. I wish to have it count in one second pulses. I am a newbie so be gentle on me…thanks
[ # ]
#include <SPI.h>

const byte MAX7219_REG_NOOP = 0x0;
// codes 1 to 8 are digit positions 1 to 8
const byte MAX7219_REG_DECODEMODE = 0x9;
const byte MAX7219_REG_INTENSITY = 0xA;
const byte MAX7219_REG_SCANLIMIT = 0xB;
const byte MAX7219_REG_SHUTDOWN = 0xC;
const byte MAX7219_REG_DISPLAYTEST = 0xF;

void sendByte (const byte reg, const byte data)
{
digitalWrite (SS, HIGH);
SPI.transfer (reg);
SPI.transfer (data);
digitalWrite (SS, LOW);
} // end of sendByte

void setup ()
{
SPI.begin ();
sendByte (MAX7219_REG_SCANLIMIT, 7); // show 8 digits
sendByte (MAX7219_REG_DECODEMODE, 0xFF); // use digits (not bit patterns)
sendByte (MAX7219_REG_DISPLAYTEST, 0); // no display test
sendByte (MAX7219_REG_INTENSITY, 001); // character intensity: range: 0 to 15
sendByte (MAX7219_REG_SHUTDOWN, 1); // not in shutdown mode (ie. start it up)
} // end of setup

void number (const unsigned long num)
{

char buf [5 ];
sprintf (buf, “%08ld”, min (max (num, 0), 99999999));

// send all 8 digits
for (int digit = 0; digit < 8; digit++)
{
byte c = buf [digit];
if (c == ’ ’ )
c = 0xF; // code for a blank
else
c -= ‘0’;
sendByte (8 - digit, c);
}
} // end of number

unsigned long i;

void loop ()
{
number (i++);
} // end of loop

frenchyx2:
I am a newbie so be gentle on me...thanks

Well, of course the first step is "RTFM" - the "sticky" post at the top which says "How to use this forum - please read". Go back to your post, select "modify", highlight the code section and use the "code ([ # ])" icon above to mark it up as such so we can read it properly and click "Save".

How accurate do you want? If it doesn't need to be particularly accurate, add a "delay(1000)" (one thousand milliseconds) to the end of your counting loop. Tweak the 1000 (downward) to account for the time the loop and all else takes to run.

If reasonably accurate, you need a loop which checks on millis() and waits (by cycling back) for a 1000 mS advance on the last recorded step.

If really accurate, you need a DS3231 RTC module

Yes, simple change to start for not necessarily accurate:

void loop () 
 {
 number (i++);
delay(997); // delay ~0.997 seconds, increase by 1, 2 if needed
 }  // end of loop