The DS1620 is a very
accurate thermometer. It is accurate to .5 Celsius.
The routines below will convert from Celsius to Fahrenheit.
Features
-
Requires no external
components
-
Supply voltage range
covers 2.7v to 5.5v
-
Measures temperatures
from -55°C to +125°C in .5°C increments and -67°F to +257°F in .9°F
increments
-
Converts temperature to
to digital in 1 second (max)
-
3 Wire Interface
I'm not going to get into
the theory behind the DS1620 or the 3 wire protocol. If you want that
its available in the Data sheet. I have provided library to shield
you from the details.
Functions
DS1620init(IO,CLK,RST)
This must be called before any of the other routines are called. It
sets up the DS1620 for reading.
IO The Dios port connected to the DQ line of the DS1620
CLK The Dios port connected to the CLK line of the DS1620
RST The Dios port connected to the RST line of the DS1620
ds1620readtemp(IO,CLK,RST)
Reads the the temperature of the DS1620. Returns a FLOAT value.
IO The Dios port connected to the DQ line of the DS1620
CLK The Dios port connected to the CLK line of the DS1620
RST The Dios port connected to the RST line of the DS1620
CelsiustoF(celcius)
Returns the converted Celsius data as Fahrenheit. Returns a FLOAT
value.
celcius This is a float value that represents the Celsius
reading.
Hookup

func main()
dim celcius as float
dim fahrenheit as float
DS1620init(0,1,2)
again:
celcius = ds1620readtemp(0,1,2)
fahrenheit = CelsiustoF(celcius)
print {0.1} celsius
print (0.1) fahrenheit
pause 500
goto again
endfunc
include \lib\Dios1620.lib