How to code integer in MAX 7219 8-Digit seven segment

I using LedControl.h for demo7segment but i dont know about how to using the code for integer to display in seven segment, please
Thank you

One method is to use a short lookup table, one entry for each decimal or hex digit.
A seven segment display segment pattern can normally be stored in a single byte, one bit per segment, plus decimal point.

i am trial use the code below here but i dont know about modulo and how it can be ones or tens or hundreds can anyone describe me (how it can modulo by 10 for ones or tens)

#include "LedControl.h"

LedControl lc=LedControl(12,11,10,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);
    int v=100;
}

void loop {
    int v =23;
    int ones;
    int tens;
    int hundreds;

 
    ones=v%10;
    v=v/10;
    tens=v%10;
    v=v/10;
    hundreds=v;     

    //Now print the number digit by digit
    lc.setDigit(0,2,(byte)hundreds,false);
    lc.setDigit(0,1,(byte)tens,false);
    lc.setDigit(0,0,(byte)ones,false);
}

or can you explain me about short lookup table

Modulo

Ok i got it thank you , how to clear zero in seven segment. example i write 23 and seven segment show 023

You can use sprintf() to convert the number to characters:

char buff[9];
sprintf(buff, "%3d", v);

The format string "%3d" means that the value will be represented as 3 characters, with leading spaces instead of zeroes. (If you used "%03d", you would get leading zeroes.)

Then you can use setChar() to send the characters to the display:

for (byte i = 0; i < 8; i++) {
  lc.setChar(0,i,buff[i],false);
}

how to clear zero in seven segment. example i write 23 and seven segment show 023

Turn off all the segments for that digit.

thank you for attention im code right here

int v=12345;
char buff[9];
sprintf(buff, "%3d", v);
for (byte i = 0; i < 8; i++)
 {
  lc.setChar(0,i,buff[i],false); 
}

but the seven segment show 3c054321 ?

TolpuddleSartre:
Turn off all the segments for that digit.

i am use this code but i dont not to delete leading zero, how i can code to delete leading zero

v = 345;
void printNumber(unsigned int v){
    int ones;
    int tens;
    int hundreds;
    ones=v%10;
    v=v/10;
    tens=v%10;
    v=v/10;
    hundreds=v%10;   
    v=v; 
    lc.setDigit(0,2,(byte)hundreds,false);
    lc.setDigit(0,1,(byte)tens,false);
    lc.setDigit(0,0,(byte)ones,false);
}

Rahmatt:
thank you for attention im code right here

int v=12345;

char buff[9];
sprintf(buff, "%3d", v);
for (byte i = 0; i < 8; i++)
{
  lc.setChar(0,i,buff[i],false);
}




but the seven segment show 3c054321 ?

You sprintf three digits, then you send eight to the display(in reverse order, it looks to me)

sprintf returns the number of characters it has formatted - use that to send the correct number of digits to the display.

Try this

int v=12345;
char buff[9];
sprintf(buff, "%8d", v);
for (byte i = 0; i < 8; i++)
 {
  lc.setChar(0,7-i,buff[i],false); 
}

TolpuddleSartre:
You sprintf three digits, then you send eight to the display(in reverse order, it looks to me)

sprintf returns the number of characters it has formatted - use that to send the correct number of digits to the display.

Thank you for attention i got it thank you again

PaulRB:
Try this

int v=12345;

char buff[9];
sprintf(buff, "%8d", v);
for (byte i = 0; i < 8; i++)
{
 lc.setChar(0,7-i,buff[i],false);
}

Ok i got it thank you for attention
thank you

i am sorry for many question
i just running the code in arduino with variable v in long but get the maximum seven segment is 32767 if a count++ it will be -32xxx ? please
it my code

#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);

int delaytime=250;
long v = 0 ;
int pluss = 100;

void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}

void loop() { 
v = v + pluss;
printNumber(v);

}

void printNumber(long v){
char buff[9];
sprintf(buff, "%8d", v);
for (byte i = 0; i < 8; i++)
 {
  lc.setChar(0,7-i,buff[i],false); 
 }

}

Thank you

sprintf(buff, "%8ld", v);

That's a lower case L, not a one.

TolpuddleSartre:

sprintf(buff, "%8ld", v);

That's a lower case L, not a one.

Thank you i got it thank for attention,
can you give me link about "%8ld" or something like this for me to learn it

Look for printed/sprintf format specifier tutorials on C tutorial websites.