hab jetzt den code erstmal abgeändert. immerhin siehts jetzt nich nach nem error aus...
prob jetzt: "Temp.: 72 Grad"
mein code:
jemand ne idee?Code:$regfile = "m8def.dat" $crystal = 16000000 $lib "i2c_twi.lbx" 'Einbindung der I2C-Bibliothek Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portd.0 , Db5 = Portd.1 , Db6 = Portd.2 , Db7 = Portd.3 , E = Portd.4 , Rs = Portd.5 Config Lcdbus = 4 Config Sda = Portc.4 Config Scl = Portc.5 Const Lm75slaveread = &H91 Dim Lm75high As Byte Dim Lm75low As Byte Dim Temperatur As Integer Dim Nachkommastelle As String * 2 Cursor Off Noblink Cls Locate 1 , 1 Lcd "[= LM75 Test =]" Locate 2 , 1 Lcd "über I2C" Wait 1 Cls 'Anschaltung des I2C-Busses I2cinit Waitms 500 Do 'LM75 Abfrage 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 Locate 1 , 1 Lcd "Temp.: " ; Temperatur ; Nachkommastelle ; " Grad" Wait 1 Loop End







Zitieren

Lesezeichen