Declare Function Rn_cmps_druck() As Word $prog , 255 , &B11011001 , 'Quarz an / Teiler aus / Jtag aus $regfile = "m2560def.dat" $hwstack = 82 '80 $framesize = 68 ' 64 $swstack = 68 '44 $crystal = 16000000 'Quarzfrequenz Config Com4 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Open "com4:" For Binary As #4 'USB Buchse Config Scl = Portd.0 'Ports fuer IIC-Bus Config Sda = Portd.1 Dim Diff As Word Wait 3 'Warte 3 Sekunde I2cinit Do Diff = Rn_cmps_druck() Print #4 , Diff Wait 1 Loop End Function Rn_cmps_druck() As Word Local Lob As Byte Local Hib As Byte Local Cmps_slaveid As Byte Local Cmps_slaveid_read As Byte Cmps_slaveid = &HF0 'Addresse Drucksensor Cmps_slaveid_read = Cmps_slaveid + 1 'Register auswählen I2cstart I2cwbyte Cmps_slaveid I2cwbyte 2 I2cstop I2cstart I2cwbyte Cmps_slaveid_read I2crbyte Hib , Ack I2crbyte Lob , Nack I2cstop Rn_cmps_druck = Makeint(lob , Hib) End Function