Kylobeetle
Member
Hello everyone again! nice to be here with you, I have a question I would like to know, I have used and found this piece of code for displaying numbers in the
LCD taking care of not get the actual ASCII value instead of the wanted number .
This works, what im looking for its to know the meaning of this, what I have found is that its a common practice to add null value or 48 (which is the same) at the end of the "number" i want to display because if i dont do it, I would only get its ASCII value instead.. But about the "(number/1000)%10 ? What does that % there? its like the base im working with ? (base 10) ?
I just tried to analyze it by myself, but im not sure about my findings haha . thanks in advance!
LCD taking care of not get the actual ASCII value instead of the wanted number .
Code:
ch1 = (number/1000)%10;
ch2 = (number/100)%10;
ch3 = (number/10)%10;
ch4 = (number/1)%10;
Lcd_Set_Cursor(2,1);
Lcd_Print_String("Inside Main Loop");
Lcd_Set_Cursor(1,1);
Lcd_Print_String("Number: ");
Lcd_Print_Char(ch1+'0');
Lcd_Print_Char(ch2+'0');
Lcd_Print_Char(ch3+'0');
Lcd_Print_Char(ch4+'0');
This works, what im looking for its to know the meaning of this, what I have found is that its a common practice to add null value or 48 (which is the same) at the end of the "number" i want to display because if i dont do it, I would only get its ASCII value instead.. But about the "(number/1000)%10 ? What does that % there? its like the base im working with ? (base 10) ?
I just tried to analyze it by myself, but im not sure about my findings haha . thanks in advance!