MATLAB Answers

0

Simulink: Buffer for specified number of values

Asked by Andreas Nagl on 14 Oct 2017
Latest activity Edited by Andreas Nagl on 14 Oct 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

  0 Comments

Sign in to comment.

0 Answers