I2C Write Block Description
This block supports the I2C peripheral interface in Mem Write mode. It is used to write data to a specific register or memory address inside a Slave device (such as a sensor or EEPROM memory). The block automatically sends the device address first, followed by the defined internal register address, and finally the actual input data.

Table of Contents
Inputs
| Input Name | Type | Description |
|---|---|---|
| Register address | uint8 / uint16 | The address of the register to which data is to be written. The input data type depends on the value of the Register address size parameter. |
| Write data | uint8[ ] | Data to be sent via the I2C interface. The size of the input depends on the value of the Write size parameter. |
Outputs
| Output Name | Type | Description |
|---|---|---|
| Status | uint8 | Transmission status. Returns:1 transmission successful0 transmission failed |
Block Parameters
| Parameter | Description |
|---|---|
| I2C Number | I2C module number (for a single MCU I2C, this should be set to 0) |
| Slave address | Address of the slave device |
| Mode | Block operating mode |
| Register address size | Register address size:I2C_MEMADD_SIZE_8BIT - 8-bitI2C_MEMADD_SIZE_16BIT - 16-bit |
| Write size | Size of the data to be written. Determines the amount of data sent from the Write Data input. |
| Timeout | How long the system will wait for the block execution |
| Sample time [s] | Function refresh rate |

CubeMX Configuration for a Given MCU
The configuration for the interface can be found on the subpage CubeMX Configuration for a Given MCU.
See Also
Last updated on