Main Content

Buffers, Switches, and Counters

Change sample rate or frame rate of signals, count events, detect edges, perform actions when events occur

Convert signal rates and frame sizes in Simulink® using frame rebuffering blocks such as the Buffer, Unbuffer, and the Delay Line blocks. Implement FIFO and LIFO buffers using the Queue, Stack blocks in Simulink, and dsp.AsyncBuffer object in MATLAB®. You can also count events, detect edges, and perform actions when events occur using the switch and counter blocks in DSP System Toolbox™.


dsp.AsyncBufferFIFO buffer


rebuffer_delayNumber of samples of delay introduced by buffering and unbuffering operations


expand all

BufferBuffer input sequence to smaller or larger frame size
Delay LineRebuffer sequence of inputs
QueueStore inputs in FIFO register
StackStore inputs into LIFO register
UnbufferUnbuffer input frame into sequence of scalar outputs
CounterCount up or down through specified range of numbers
Edge DetectorDetect transition from zero to nonzero value
Event-Count ComparatorDetect threshold crossing of accumulated nonzero inputs
Multiphase ClockGenerate multiple binary clock signals
N-Sample EnableOutput ones or zeros for specified number of sample times
N-Sample SwitchSwitch between two inputs after specified number of sample periods