-
-
hallo,
'working with atmega8 and lm75
Declare Sub Showtemperatur()
Config Serialout = Buffered , Size = 60
Const Lm75slavewrite = &H90
Const Lm75slaveread = &H91
Dim Lm75high As Byte
Dim Lm75low As Byte
Dim Temperatur As Integer
Dim Nachkommastelle As String * 2
'don't forget to define scl and sda pins !!
Config Sda = Portc.1
Config Scl = Portc.0
I2cinit
Start:
Call Showtemperatur 'this line was missing from Grillmeister Markus program
Print Temperatur ; Nachkommastelle
Wait 2
Goto Start
Sub Showtemperatur()
I2cstart
I2cwbyte Lm75slaveread
I2crbyte Lm75high , Ack
I2crbyte Lm75low , Nack
I2cstop
If Lm75high > 127 Then
Temperatur = Lm75high And 127
Temperatur = Not Temperatur
Incr Temperatur
Else
Temperatur = Lm75high
End If
Lm75low = Lm75low And 128
If Lm75low > 0 Then
Nachkommastelle = ",5"
Else
Nachkommastelle = ""
End If
'Print Temperatur ; Nachkommastelle
End Sub
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
-
Foren-Regeln
Lesezeichen