Hallo,

die Slaves "lauschen" ja auf dem Bus. Wenn nach der Startsequenz die Adresse des Slaves gesendet bestätigt der "ich bin hier". Eventuell muss man das Auslesen der Werte noch anpassen, aber zuerst solltest du die richtige Adresse haben.

Du kannst den Bus auch mit dem Scanprogramm aus den Bascom-Samples überprüfen. Da wird auch die ERR-Variable ausgewertet:
Code:
'------------------------------------------------------------------
'                    (c) 1995-2007 MCS
'                      i2cscan.bas
'purpose : scan all I2C addresses to find slave chips
'use this sample in combination with  twi-slave.bas
'Micro: Mega88
'------------------------------------------------------------------
$regfile = "M88def.dat"       ' the used chip
$crystal = 8000000            ' frequency used
$baud = 19200                 ' baud rate

Dim B As Byte

Config Scl = Portc.5          ' we need to provide the SCL pin name
Config Sda = Portc.4          ' we need to provide the SDA pin name

'we use the TWI pins of the Mega88
$lib "i2c_twi.lbx"            ' we do not use software emulated I2C but the TWI

Print "Scan start"
For B = 0 To 254 Step 2       'for all odd addresses
  I2cstart                    'send start
  I2cwbyte B                  'send address
  If Err = 0 Then             'we got an ack
     Print "Slave at : " ; B ; " hex : " ; Hex(b) ; " bin : " ; Bin(b)
  End If
  I2cstop                     'free bus
Next
Print "End Scan"
End