I2START,I2CSTOP, I2CRBYTE, I2CWBYTE
Action
I2CSTART generates an I2C start condition.
I2CSTOP generates an I2C stop condition.
I2CRBYTE receives one byte from an I2C-device.
I2CWBYTE sends one byte to an I2C-device.

Syntax
I2CSTART
I2CSTOP
I2CRBYTE var, 8/9
I2CWBYTE val

Remarks

var A variable that receives the value from the I2C-device.
8/9 Specify 8 or ACK if there are more bytes to read. (ACK)
Specify 9 or NACK if it is the last byte to read. (NACK)
val A variable or constant to write to the I2C-device.
This command works only with additional hardware. See appendix D.

These functions are provided as an addition to the I2CSEND and I2CRECEIVE functions.

See also
I2CRECEIVE I2CSEND


Example
-------- Writing and reading a byte to an EEPROM 2404 -----------------
DIM a As Byte
DIM adresW AS CONST 174 'write of 2404
DIM adresR AS CONST 175 'read adres of 2404
I2CSTART 'generate start

I2CWBYTE adresW 'send slaveadres

I2CWBYTE 1 'send address of EEPROM
I2CWBYTE 3 'send a value
I2CSTOP 'generate stop

WaitMS 10 'wait 10 mS because that is the time that the chip needs to write the data

----------------now read the value back into the var a -------------------
I2CSTART 'generate start
I2CWBYTE adresW 'write slaveadres
I2CWBYTE 1 'write address of EEPROM to read
I2CSTART 'generate repeated start
I2CWBYTE adresR 'write slaveadres of EEPROM
I2CRBYTE a,9 'receive value into a. 9 means last byte to receive
I2CSTOP 'generate stop
PRINT a 'print received value
END