für master :

Config Sda = Portb.5

Config Scl = Portb.7

Dim X As Byte , Slave As Byte

X = 0 'reset variable

Slave = &H40 'slave address of a PCF 8574 I/O IC

I2creceive Slave , X 'get the value

Print X 'print it





Dim Buf(10)as Byte

Buf(1) = 1 : Buf(2) = 2

I2creceive Slave , Buf(1) , 2 , 1 'send two bytes and receive one byte

Print Buf(1) 'print the received byte

End