Hallo,
anschluss passt, Programm hab ich das grad probiert:
Code:
'
$regfile = "attiny2313.dat"
$crystal = 16000000
$baud = 9600
Config Scl = Portb.7
Config Sda = Portb.5
Dim Device As Byte
Dim Deviceread As Byte
Dim Lowtemp As Byte
Dim Hightemp As Byte
I2cinit
Device = &H90
Deviceread = &H91
Print
Print "DS1621 Temperatur"
' Hauptprogramm
Do
I2cstart
I2cwbyte Device
I2cwbyte &HEE 'Temperaturmessung anstoßen
I2cstop
I2cstart
I2cwbyte Device
I2cwbyte &HAA 'Temperaturmessung Lesekommando
I2cstart
I2cwbyte Deviceread
I2crbyte Lowtemp , Ack 'LSB holen
I2crbyte Hightemp , Nack 'MSB holen
I2cstop
Print Lowtemp ; "," ;
If Hightemp = &H80 Then
Print "5"
Else
Print "0"
End If
Waitms 700
Loop
End
Ich hab jetzt aber nicht genauer geschaut, ob das mit einer negativen Temperatur mit dem ,5 so stimmt !
Lesezeichen