/* *
* the 16C term in the formulas below is the raw Celsius * 16 *
* temperature data in the 'rawtemp16' var'. a rounded value *
* of °C*10 or °F*10 is used for display with a decimal point *
* inserted manually before the last (tenths) digit. *
* *
* 10F = 18C + 320 = 16C + 2C + 320 = 16C + (16C+4)/8 + 320 *
* */
bin = rawtemp16 + 4; // rounding
bin /= 8; // now bin = '2C' (rounded)
bin += rawtemp16; // now bin = 16C + 2C
bin += 320; // now bin = 18C + 320 = 10F
if(negflag = bin.15) // set/clr "negflag", if negative
bin = -bin; // twos complement the temperature