Při délce vedení cca 4m funguje odečítání teploty správně. Při délce vedení cca 10m dochází zvl. při záporné teplotě k chybě až 50%. Potřeboval bych poradit jeli chyba v délce vedení, či spíše v SW.
Zde je použitá rutina
void mereni()
{ asm WDR
Ow_Reset(&PORTd, 2); // Onewire reset signal
Ow_Write(&PORTd, 2, 0xCC); // Issue command SKIP_ROM
Ow_Write(&PORTd, 2, 0x44); // Issue command CONVERT_T
delay_us(200);
Ow_Reset(&PORTd, 2);
Ow_Write(&PORTd, 2, 0xCC); // Issue command SKIP_ROM
Ow_Write(&PORTd, 2, 0xBE); // Issue command READ_SCRATCHPAD
delay_ms(100);
TI=Ow_Read(&PORTd, 2);
delay_ms(100);
TI=(Ow_Read(&PORTd, 2) <<
![Cool 8)](./images/smilies/icon_cool.gif)
delay_ms(100);
if (TI & 0x8000) // check if temperature is negative
{tin[0] = '-'; TI = ~TI + 1;} else tin[0]='+';
TI=TI>>4;
tin[1] = (TI/10)%10 + 48; // Extract tens digit
tin[2] = TI%10 + 48; // Extract ones digit
asm WDR
Ow_Reset(&PORTd, 3); // Onewire reset signal
Ow_Write(&PORTd, 3, 0xCC); // Issue command SKIP_ROM
Ow_Write(&PORTd, 3, 0x44); // Issue command CONVERT_T
delay_us(200);
Ow_Reset(&PORTd, 3);
Ow_Write(&PORTd, 3, 0xCC); // Issue command SKIP_ROM
Ow_Write(&PORTd, 3, 0xBE); // Issue command READ_SCRATCHPAD
delay_ms(100);
TO= Ow_Read(&PORTd, 3);
delay_ms(100);
TO = (Ow_Read(&PORTd, 3) <<
![Cool 8)](./images/smilies/icon_cool.gif)
delay_ms(100);
if (TO & 0x8000) //TOUTje TOPOM ve znacich
{tout[0] = '-'; TO = ~TO + 1; } else tout[0]='+';
TO=TO>>4;
tout[1] = (TO/10)%10 + 48; // Extract tens digit
tout[2] = TO%10 + 48; // Extract ones digit
acit=0;
asm WDR
return;