Current example:
Code: Select all
repeat
Ow_Reset(PORTA, 5); // onewire reset signal
Ow_Write(PORTA, 5, $CC); // issue SKIP ROM command to DS1820
Ow_Write(PORTA, 5, $44); // issue CONVERT T command to DS1820
Delay_us(120); // <-------- HERE -----------
i := Ow_Reset(PORTA, 5);
Ow_Write(PORTA,5, $CC); // issue SKIP ROM command to DS1820
Ow_Write(PORTA,5, $BE); // issue READ SCRATCHPAD command to DS1820
j1 := Ow_Read(PORTA, 5); // get result
j2 := Ow_Read(PORTA, 5); // get result
....
ByteToStr(j2, text); // decimal
Lcd_Chr(2, 11, text[2]);
Delay_ms(500);
until false;
New proposal:
Code: Select all
repeat
Ow_Reset(PORTA, 5); // onewire reset signal
Ow_Write(PORTA, 5, $CC); // issue SKIP ROM command to DS1820
Ow_Write(PORTA, 5, $44); // issue CONVERT T command to DS1820
Delay_ms(750); // <--- changed here
i := Ow_Reset(PORTA, 5);
Ow_Write(PORTA,5, $CC); // issue SKIP ROM command to DS1820
Ow_Write(PORTA,5, $BE); // issue READ SCRATCHPAD command to DS1820
j1 := Ow_Read(PORTA, 5); // get result
j2 := Ow_Read(PORTA, 5); // get result
....
ByteToStr(j2, text); // decimal
Lcd_Chr(2, 11, text[2]);
Delay_ms(500); // <--- leave out this delay
until false;
p.s. I took the worst case max. conversion time here (750 ms for the DS18S20).
Thanks in advance and keep up the good work!