I made the I2C code working, and I have LED drive working as well.
Right now I only show integer temperature, using /10 divide, and *10 multiply, which is costly in terms of code size. How can I display the fractional part?
The sensor gives 2 EXP 0 to 2 EXP 6 in the MSB, and 2 EXP -1 to 2 EXP -4 in the LSB.
The data I need for the 7segment drive is 16 bit integer (hexadecimal).
The points are driven seperately.
If you logically shift the four fractional bits left by 4, they turn into a range from 0 .. 15.
However, it sounds as if you actually have bits -4 .. -1 in the high nybble of the byte; if so, you actually want to shift it right 4 to get it into the 0 .. 15 range.
Well if I only have one bit for 0.5,
how can I compute 5?
And then I take the next bit, 0.25,
how can I computer 75 (or 25)?
It's maybe trivial but I am really not getting it.
My idea was to use a lookup table but is there any kind of algorithm?
It would really be helpful to to finish my program.
Right now it is only showing integer value.