Hi, Santa
Have a look to the Basic Stamp 1 application notes ( ch.23 : DS 1620 digital thermometer ... )
This is page 189 from the Basic stamp programming manual 1.9 ...
Download it from Parallax inc.
- and do not forget the "Include modedef ...."
Alain
PS: another version
' Sous-programmes de dialogue avec un DS 1620
' connecte comme indique figure 7.15
' Version pour Basic Stamp II ou II-SX
' Definition des constantes et variables
CLK con 15
DQ con 14
RST con 13
wcfg con $0C
cpucont con 2
startc con $EE
rtemp con $AA
temp var word
' Initialisation
low RST
high CLK
pause 100 ' attente prise en compte DS 1620
high RST
shiftout DQ, CLK, lsbfirst, [wcfg, cpucon]
low RST
pause 50 ' attente prise en compte DS 1620
high RST
shiftout DQ, CLK, lsbfirst [startc]
low RST
pause 1000 ' attente d'une seconde
' Lecture de la temperature mesuree par le DS 1620
lecture:
high RST
shiftout DQ, CLK, lsbfirst [rtemp]
shiftin DQ, CLK, lsbpre [temp\9]
low RST
' La temperature mesuree par le DS 1620
' est disponible dans temp codee sur 9 bits
Listing 7.6
Bookmarks