Main Content

Binary Encoding/Decoding Resync Loopback Test (with Baseboard Blocks)

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 incrementing 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 1024 in width. The count in the first element tells how many elements are significant. The Demux blocks discard the uninteresting parts of the signal.

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

To test this model:

  1. The target computer must have two legacy serial ports.

  2. Connect legacy serial port 1 to legacy serial port 2 with a null modem cable.

This example is configured to use baseboard serial ports (legacy serial port 1 and legacy serial port 2). You can also use legacy serial port 3 and legacy serial port 4 by changing the board setup in the Baseboard blocks. Other serial blocks could be used in place of the Baseboard blocks.

open_system('slrt_ex_serialbaseboardbinarysplit');

See Also