MATLAB Answers

Simulink: Buffer for specified number of values

3 views (last 30 days)
Andreas Nagl
Andreas Nagl on 14 Oct 2017
Edited: Andreas Nagl on 14 Oct 2017
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


Sign in to comment.

Answers (0)

Translated by