I2C_WRITE  i2cslave, dmstart, count     
Purpose Special command to execute a I2C WRITE out of the PLC's I2C port (requires I2C-FRTC module to be installed). The CPU will send a I2C START, followed by the slave address byte (i2cslave) and count number of data bytes from the DM[dmstart] up to DM[dmstart+count-1]
i2cslave - The 7-bit slave address that the CPU is writing to.
dmstart - The starting index of the DM[ ] that contains the first data byte
count - number of byte data to send (maximum is dependent on the slave).
Examples   DM[5]= 12: DM[6]= 34 : DM[7]= 56
  I2C_WRITE &H60,5,3
  I2C_STOP
Comments Following the START bit, the CPU will write the 7-bit slave address &H60 (=110 0000 binary) and a R/W bit set to 0, followed by the byte data stored in DM[5], DM[6] and DM[7].

The command automatically checks for ACK received from the slave device , and the user program can check the status of this operation by testing the STATUS(2) function. STATUS(2) returns a 1 if ACK is received , and 0 if no ACK is received after time out.

Note: This command does not automatically generate the I2C STOP bit, this is to allow the CPU to perform a I2C_READ following a I2C_WRITE.  I2C READ after WRITE is commonly encountered in I2C protocol which requires using the I2C_WRITE to set the internal pointer address in the slave device and then followed by the I2C_READ command.

Therefore, if your command involves only I2C_WRITE, you must end the WRITE command by executing a I2C_STOP statement.

See Also I2C_READ, 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