I2C_READ  i2cslave, dmstart, count     
Purpose Special command to execute a I2C_READ out of the PLC's I2C port (requires I2C-FRTC module to be installed). The CPU will send a I2C START bit, followed by the slave address byte (i2cslave) with "R/W" bit set to high, and then send out the number of clock pulses required to read count number of data bytes from the the slave. The data bytes received from the slave will be stored in the memory location DM[dmstart] to DM[dmstart+count-1].  After receiving all the required data bytes the CPU will send the I2C STOP bit to the slave to end the communication.
i2cslave - The 7-bit slave address that the CPU is reading from.
dmstart - The starting index of the DM[ ] that is to receive the first data
count - number of byte data bytes to read from the slave.
Examples  
  I2C_READ &H0C,21,2   ' read 2 bytes into DM[21] and DM[22]
 
Comments After sending the START bit, the CPU will write the 7-bit slave address &H60 (=110 0000 binary) and a R/W bit set to 1, followed by 16 clock pulses to read 2 bytes of  data and store into DM[21] and DM[22], and then the CPU will generate the STOP bit.

i.e. there is no need execute the I2C_STOP command after an I2C_READ command.

See Also I2C_WRITE, I2C_STOP

Note:

1. This command is applicable only to Nano-10 and FMD PLC models with firmware >=r74 and I2C interface.
2. This command is ignored by i-TRiLOGI simulator.

  backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual