Hi all,
I was wondering if there is any way of sending and receiving multiple bytes through I2C. I see that the I2c_SyncTransmit block has a buffer size input, so I guess it is possible, but the Data Rx output is a uint8 variable. In case I want to receive 8 bytes, am I supposed to build a buffer of eight uint8? If this is the case, how do I know when to increase the position of the FIFO?
I also have a similar question with transmission. Data Tx in a uint8 input, so I can't send the eight bytes concatenated. How should a I send the data then?
Thanks in advance,
BR
Hello @AsierMaser,
Yes, it is possible to send and receive multiple bytes using the I2C block. The Data Rx output and Data Tx input can be Data Store memory blocks containing vectors of uint8 data types, as you can see in the image below.
If you want to send multiple bytes from the master, you can simply create a Data Store Memory block containing the bytes and give it as an input (Data Tx) for the block, using the Data Store Read block.
If you want to request multiple bytes from the slave, you must specify the number of bytes in the Buffer Size block input, create a Data Store Memory block with the same size as the number of bytes, and provide it as an output for the block using the Data Store Write block.
Data Store Memory
Hope this helps,
Cristina