Simulink: Buffer for specified number of values

1 回表示 (過去 30 日間)
Andreas Nagl
Andreas Nagl 2017 年 10 月 14 日
編集済み: Andreas Nagl 2017 年 10 月 14 日
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 件)

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by