Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

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