I2COUT
 
Syntax

int I2COUT (int sda_pin, int scl_pin, int slaveADDR , int cnt, char *outList);

// I2COUT returns TRUE if the device was present and responding

Description


I2COUT will send a series of bytes from an I2C slave device.  sda_pin is any expression defining the SDA pin to use.  scl_pin will be designated the SCL pin.  slaveADDR will select a device on the I2C bus.

After that cnt bytes will be written to the slave from the character array outList

I2C is a byte oriented bus, so each transaction will send a byte values (0 to 255) to an I2C slave. If the value from an expr ession in the OutputList is larger than 8 bits, the MSBs will be truncated.

If a I2C device responds the function returns 1, else 0.

Data is shifted out at 350 Kbits/sec.

Example

   case 41:   // test EEPROM 24LC02 on pins 0 == SDA and 1 == SCL
    shortMessage[0] = 0;
    for (i=1; i<8; i++) shortMessage[i] = 0x30+i; // set shortMessage to "1234567"  
    present = I2COUT (0, 1, 0xA0, 8, shortMessage);

See also