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!
1234 /1000 = 1... (Modulus not needed on first... If the number is five figures it will help)
1234 / 100 = 12... Modulus 10 = 2 ...
1234 /10 = 123... Modulus 10 = 3...
In this example the divide isn't necessary .. But some compliers struggle with modulus on a larger number.
Some times I divide by 1000 and then I remove the thousands.
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"
You're not adding a 'null' value, you're adding the ASCII value of '0' which is 48 DEC - although personally I usually add 0x30, the same value in HEX.
You're not adding a 'null' value, you're adding the ASCII value of '0' which is 48 DEC - although personally I usually add 0x30, the same value in HEX.