// Next we perform a 9 byte sequential read block;
// 0 Temperature_LSB (just the LSB gives 0xFF = +127.5'C)
// 1 Temperature_MSB (NOTE! MSB only used for -'C values)
// 2 Temp alarm High (User byte 1)
// 3 Temp alarm Low (User byte 2)
// 4 -reserved-
// 5 -reserved-
// 6 Count_remain
// 7 Count_per_C (dont bother reading the last 2 bytes)
// 8 CRC
temp = OW_Read(&PORTA,2); // Get temperature LSB
temp_sign = OW_Read(&PORTA,2); // Get temperature MSB (sign)
j = OW_Read(&PORTA,2); // AL hi (wasted)
j = OW_Read(&PORTA,2); // AL lo (wasted)
j = OW_Read(&PORTA,2); // (wasted)
j = OW_Read(&PORTA,2); // (wasted)
temp_fine = OW_Read(&PORTA,2); // Get Count_remain fine res bits
//------------------------------------------------
// The temperature results are in 3 bytes;
// temp = temperature in 0.5'C steps ie 0xFF = 127.5'C
// temp_sign = (0xFF if temp is negative)
// temp_fine = fine temp resolution bits resolution 1/16'C
//------------------------------------------------
// calc a 16bit temperature in btemp
temp_fine = (16 - temp_fine); // get the 4 fine bits
temp_fine = (temp_fine & 0x0F); // safe, keep just 4 bits
btemp = (temp / 2); // get whole degrees
btemp = (btemp << 4); // make room for fine bits
btemp += temp_fine; // add the 4 fine bits
btemp -= 0x04; // subtract 0.25'C (as per datasheet formula)