I2C Register Read
Master device reads data from the I2C slave device or I2C slave device register(s)
Simulink Support Package for LEGO MINDSTORMS EV3 Hardware
In the I2C Register Read block, the master device reads data from the I2C slave device or the I2C slave device register. The EV3 brick acts as the master device. Any I2C device, such as a color sensor, can act as the slave device. Both the master and the slave device must be connected over the same I2C network for successful communication.
Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware supports the I2C serial data communication protocol, where each device on the I2C network is referenced by a unique 8-bit address or identifier.
Data — Output data
The block outputs the data read by the master from the slave device or slave device register(s) as a N-by-1 vector, where N represents the data size.
Status — Status of master read operation
The block outputs the status of the master read operation on the slave device or the slave device register.
0: Indicates a successful read operation, which means that the data received on the Data port is valid.
1: Indicates an unsuccessful read operation, which means that the data received on the Data port is invalid.
To enable this port, select Output error status.
EV3 brick input port number — Input port connected to slave device
4 (default) |
Select the input port on the EV3 brick to which the slave device is connected. There are four ports on the hardware and you can select any one of the ports. If connecting multiple slave devices, specify a unique port for each slave device.
Slave address — I2C slave device address or identifier
10 (default) | scalar in the range [
Enter the I2C slave device address (decimal format) on which the master performs the read operation.
Slave register address — I2C slave device register address
0 (default) | scalar in the range [
Enter the register address (decimal format) of the I2C slave device on which the master performs the read operation.
Data type — Type of data read by master
uint8 (default) |
Select the type of data read by the master from the slave device or slave device register. The master can read only a maximum of 32 bytes of data in a single read operation.
Data size (N) — Size of data
1 (default) | scalar
Enter the size of data that the Master reads from the slave device or slave device register.
For example, when you specify a value of 5, the master reads data from five contiguous slave device registers starting from the register address specified in the Slave register address parameter.
The master can perform a group read operation only on contiguous slave device registers.
Sample time — Time interval at which master reads data
0.1 (default) | scalar in the range [
Enter the time interval (in seconds) at which the master reads data from the slave device or slave device register.
Introduced in R2020b