mmike87 wrote:another way is to delete all the decimal numbers in this way: the risult of 5/1024/3*100 is 0,162760 so i can do the counts with an int type eg. 103 (adc result) * 1627 (constant without decimals) = and than print char[1] char[2] "." char[3] char[4] .... how many you want..
what do you think about? thank you
Certainly the best method for simple calculations is to move to fixed-point math and operate on integral numbers only.
In your case it should be (adc result)/1023*(normalisation factor=500/3) which gives (adc result)*0.1629195..
(adc result)*16292 is pretty good fixed-point approximation with decimal point fixed before fifth digit from end (i.e. result will range from 0 to 16 667 716 corresponding to 0.00000 to 166.66716). Declaring the result as unsigned long and using LongWordToStrWithZeros conversion procedure, one may easily form a string for display with properly placed digital point and up to five significant digits after it.