Unless you are trying to get the fractional part of the reading 10 bits is all you need.
Unless you are trying to get the fractional part of the reading 10 bits is all you need.
Dave
Always wear safety glasses while programming.
the data can be read in msb first by shiftin but it is then translated to a normal binary representation so bit 14 is read as bit 14.why do I have to shift by "2" instead of what has been said above (shift by 3) or even shift by 1 since bit 14 is the second bit to start with?
shifting by 2 is incorrect , as dave indicated
Temp = RawTemp >> 5
will get the high 10 bits of the 12bit reading ,resulting in the integer component of the reading
or
Temp = RawTemp >> 3
int_part=temp/4
fract_part=(temp//4)*25
lcdout $FE, $C0,"Tmp ", #int_part,".",dec2 fract_part," C"
Warning I'm not a teacher
This is confusing to me.
My code gives me almost exactly what my home thermometer shows:
This codedisplay this:Code:Temp = RawTemp >> 3 int_part=temp/4 fract_part=(temp//4)*25 lcdout $FE, $C0,"Tmp ", #int_part,".",dec2 fract_part," C"
Where is the truth?
Last edited by flotulopex; - 16th April 2017 at 12:42. Reason: typo
Roger
for a start your temp var is a declared as byte , how can 12 bit reading fit in that ?
Warning I'm not a teacher
I corrected my code just after I sent it - couldn't edit the post anymore, should have mentionned it, sorry![]()
Roger
Anyway, I understand the calculation to get the temperature value BUT why do I have around 5°C diffrence between the thermocouple and my home thermometer?
Must a thermocouple be kind of "adjusted" (correct the result in the code) or something like that?
Roger
Bookmarks