Rev Author Line No. Line
1767 kaklik 1  
2 float ds1820_read()
3 {
4 int8 busy=0, temp1, temp2;
5 signed int16 temp3;
6 float result;
7  
8 onewire_reset();
9 onewire_write(0xCC);
10 onewire_write(0x44);
11  
12 while (busy == 0)
13 busy = onewire_read();
14  
15 onewire_reset();
16 onewire_write(0xCC);
17 onewire_write(0xBE);
18 temp1 = onewire_read();
19 temp2 = onewire_read();
20 temp3 = make16(temp2, temp1);
21  
22 result = (float) temp3 / 16.0; //calculation pro DS18B20 with 0.1 deg C
23  
24  
25 delay_ms(200);
26 return(result);
27  
28 }