How to use variables as input for Data size(N) of Raspberry Pi I2C Master Read block?
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am reading characters of more than 32 bytes from a slave(Arduino UNO/nano in my case). Since the slave can send only 32 bytes of data at one instance, the data is received as different packets. The raspberry pi acts as master and it mentions the packet number to the slave. Since the last may not have 32 bytes of data, the data size should be varying as per the remaining bytes of data to be received. The above functionality is achieved using the mscript as per below script.
no_bytes = (data_length - (packet_number * 32));
% Check the size of data to be received
if (no_bytes > 32)
receive_data = char(read(US_sensor, 32));
else
receive_data = char(read(US_sensor, no_bytes));
end
I want to achieve the same operation in Simulink using I2C Master read block. How can I set Data size as an variable which will be updated as the simulink runs in realtime.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run on Target Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!