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 CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by