Forum
DS18B20 mit BASCOM AVR (Elektronik)
» dim scp(9) as Byte. Das ist ein Array mit 10 Feldern. Das Feld 0 muss auch
» mitgezählt werden. 0 - 9 ergibt 10 Felder also 10 Bytes.
Ich weiß nicht. Nach diesem Beispiel:
>>>
' Minimalprogramm für Temperaturmessung
Config 1wire = Portc.7
Dim Sep(9) As Byte
1wreset ' Initialisierung
1wwrite &HCC ' überspringe ROM-Befehl
1wwrite &H44 ' Temperaturmessung anstoßen
Waitms 500 ' warten bis Messung fertig
1wreset ' Initialisierung
1wwrite &HCC ' überspringe ROM-Befehl
1wwrite &HBE ' Temperatur auslesen
Sep(1) = 1wread(9) ' Daten in ein Array lesen, beschreibt Sep(1) bis Sep(9)
Wait 1
>>>
( Zu finden auf https://rn-wissen.de/wiki/index.php/Bascom_und_1-Wire )
beginnt der Index bei 1. Das bedeutet, xy liest ein Byte zu wenig aus.
Ausschnitt aus dem Datenblatt:
The core functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the
DS18B20 is configurable (9, 10, 11, or 12 bits), with 12-bit readings the factory default state. This
equates to a temperature resolution of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. Following the issuance of
the Convert T [44h] command, a temperature conversion is performed and the thermal data is stored in
the scratchpad memory in a 16-bit, sign-extended two’s complement format. The temperature
information can be retrieved over the 1-Wire interface by issuing a Read Scratchpad [BEh] command
once the conversion has been performed. The data is transferred over the 1-Wire bus, LSB first. The
MSB of the temperature register contains the “sign” (S) bit, denoting whether the temperature is positive
or negative.
--
Es ist unter der Würde eines Technikers, die Gebrauchsanweisung zu lesen!
Gesamter Thread:






















