Simulink: Buffer for specified number of values

2 visualizaciones (últimos 30 días)
Andreas Nagl
Andreas Nagl el 14 de Oct. de 2017
Editada: Andreas Nagl el 14 de Oct. de 2017
Hello,
I have an Arduino TCP/IP Receive block in my model, that emits uint8 values only. Now as 4 bytes make a command for my Arduino device (1 = I2C slave register to write to, 2 and 3 = data for the I2C, 4 = value for a digital output pin), I am looking for a buffer that does the following:
Collect 4 bytes and then send them to my own MATLAB function that distributes everything to I2C/digital outputs. And then wait for the next 4 bytes... And so on.
I looked at the Buffer and Tapped Delay blocks from the DSP System Toolbox as well as Tapped Delay, but they don't seem to do what I want (adding zeroes to the signal before/after, etc.).
Is there a block I am not aware of that does what I want, or is it necessary to implement this myself (e.g. a MATLAB function with persistent variables that act as the buffer or is there a better way?)?
Thanks a lot!
Best, Andreas

Respuestas (0)

Categorías

Más información sobre Arduino 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!

Translated by