Main Content

Binary Encoding/Decoding Resync Loopback Test

This model shows the ability of the FIFO Read BINARY block to handle messages that are interrupted and only partially complete. This is a worst case example where every message is interrupted.

The Segmented Message Constructor subsystem contains blocks that prepare and send only parts of messages on each time step.

On the receive side, the FIFO read BINARY block is looking for two different two-character headers. If it finds [170,1] it outputs [3,170,1,N] on port 1. If it finds [170,2], it outputs [4,170,2,44,M] to port 2. N and M are numbers between 0 and 255 that are incremenenting and decrementing, respectively.

If a message header is not found in the FIFO on a given time step, then that port will output 0. The outputs are padded to the maximum vector size specified in the FIFO Read BINARY block. In this example output vectors are 6 in width. The count in the first element tells how many elements are significant.

Scope 1 displays the received message 1 data. Scope 2 displays the received message 2 data.

model = 'slrt_ex_serialbinarysplit';
open_system(model);