Hi Dirk,
so in etwa könnte es aussehen (nur das Wichtigste):
Code:#start Sensor=140 'Adresse Sensor1 readtemp() print value Sensor=156 'Adresse Sensor2 readtemp() print value 'usw. goto start '---- Funktionen ------------------------------------------------- FUNCTION readtemp() IIC.INIT IIC.start IIC.SEND Sensor IIC.SEND EEh 'temperaturmessung anstoßen IIC.STOP PAUSE 10 IIC.start IIC.SEND Sensor IIC.SEND 22h 'temperaturmessung stoppen IIC.stop '--------------------------- IIC.start IIC.SEND Sensor IIC.SEND AAh 'temperaturmessung Lesekommando IIC.stop IIC.start IIC.SEND (Sensor+1) 'lowtemperaturbyte auslesen IIC.GET value minusflag = OFF IF value > 128 THEN minusflag = ON value = (255-value)+1 END IF temperatur = value IIC.stop '------------------------------ IIC.start IIC.SEND Sensor IIC.SEND A8h 'Counter Lesekommando IIC.stop IIC.start IIC.SEND (Sensor+1) 'Counter auslesen IIC.GET value counter = value IIC.stop '----------------------------- IIC.start IIC.SEND Sensor IIC.SEND A9h 'Slope Lesekommando IIC.stop IIC.start IIC.SEND (Sensor+1) 'Slope auslesen IIC.GET value slope = value IIC.stop IIC.OFF IF minusflag THEN value=((temperatur * 100 - 25)-((slope-counter)*100/slope*100)/100)/10 value=value*(-1) ELSE value=((temperatur * 100 - 25)+((slope-counter)*100/slope*100)/100)/10 END IF END FUNCTION
Lesezeichen