I2CSEND

Top  Previous  Next

Action

Send data to an I2C-device.

 

 

Syntax

I2CSEND slave, var

I2CSEND slave, var , bytes

 

 

Remarks

Slave

The slave address off the I2C-device.

Var

A byte, integer/word or numbers that holds the value, which will be, send to the I2C-device.

Bytes

The number of bytes to send.

 

When an error occurs, the internal ERR variable will return 1. Otherwise it will be set to 0.

 

 

ASM

The I2C routines are located in the i2c.lib/i2c.lbx files.

 

 

See also

I2CRECEIVE , I2CSTART, I2CSTOP , I2CRBYTE , I2CWBYTE

 

 

Example

Config Sda = Portb.5

Config Scl = Portb.7

Dim X As Byte , A As Byte , Bytes As Byte

X = 5                                                       'assign variable to 5

Dim Ax(10)as Byte

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

I2csend Slave , X                                           'send the value or

 

 

For A = 1 To 10

Ax(a) = A                                                 'Fill dataspace

Next

Bytes = 10

I2csend Slave , Ax(1) , Bytes

End