Code: Select all
//--- Perform temperature reading
Ow_Reset(PORTE, 2); // Onewire reset signal
Ow_Write(PORTE, 2, 0xCC); // Issue command SKIP_ROM
Ow_Write(PORTE, 2, 0x44); // Issue command CONVERT_T
Delay_us(120);
Ow_Reset(PORTE, 2);
Ow_Write(PORTE, 2, 0xCC); // Issue command SKIP_ROM
Ow_Write(PORTE, 2, 0xBE); // Issue command READ_SCRATCHPAD
This means that the scratcpad will be read before the tempconversion finished, at least the first and probably also the second loop. Eventually the readings will be OK because the first temp conversion will be finished.
Come on guys, so many starting people (will) have problems with this!!!