# Faking decimal point when printing to LCD display

I have two projects in which I would like to print a decimal value to a text display (1602 or similar HD44780 display).

One of them is a thermometer that will only display temperatures between 0 and 20 degrees Celsius with one decimal so using "byte" seem optimal. At the moment I will probably not need to do any math with the value so I could use float but I would prefer to instead use byte and add a decimal point when I print it to my LCD display. I have searched for some way to display the third number from the right, add a decimal point and then print the second and first character from the right, but I can not find any information about how to do this. Also, will the Arduino treat the value zero as 0 or 000? If it's just one "0" I could use unsigned int and map the vales to 1000-1200 and then omit the 4th character from the right when printing to the LCD my main problem still remains.

I found a similar but very old thread here

I have searched for some way to display the third number from the right, add a decimal point and then print the second and first character from the right,

I would prefer to instead use byte and add a decimal point when I print it to my LCD display

Let's assume that the value is say 15.9 How will that be stored in a byte ?

Let's assume that the value is say 15.9 How will that be stored in a byte ?

Multiply by 10, and store 159 in the byte.

Then, dividing the byte by 10, to get 15, and using % 10 to get 9, and printing "15", ".", and "9" ain't rocket surgery.

Multiply by 10, and store 159 in the byte.

Multiply what by 10 ?

ain't rocket surgery.

Indeed not, but it might be brain science Multiply what by 10 ?

The value, wherever it came from.

Indeed not, but it might be brain science Indeed it might.

The value, wherever it came from.

Note what the OP said

I will probably not need to do any math with the value so I could use float but I would prefer to instead use byte and add a decimal point when I print it to my LCD display.

PaulS:
Multiply by 10, and store 159 in the byte.

Then, dividing the byte by 10, to get 15, and using % 10 to get 9, and printing "15", ".", and "9" ain't rocket surgery.

The initial value will come from the built in AD-converter and thus be a number between 0 and 1023. At the moment I will most likely be using 4-20mA current loops so actual AD-value may be somewhere similar to 611 to 818 for 0,0°C to 25,0°C

I get dividing my mapped value with 10 to get "15" but the "% 10" is new to me. Is it this arithmetic operator you are referring to?

[edit: yes I am fully aware that I need to use int or similar for the initial value since the AD converter use 10 bits resolution so I can not get away with only using byte

I get dividing my mapped value with 10 to get "15" but the "% 10" is new to me. Is it this arithmetic operator you are referring to?

Yes.

so I can not get away with only using byte

You would only need local variables to get the temperature as float. Then, multiply by 10 and store in a global (or local) byte.