How to use variables as input for Data size(N) of Raspberry Pi I2C Master Read block?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Run on Target Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!