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:
- The target computer must have two COM ports.
- Connect COM1 to COM2 with a null modem cable.
This example is configured to use baseboard serial ports (COM1 and COM2). You can also use COM3 and COM4 by changing the board setup in the Baseboard blocks. Other serial blocks could be used in place of the Baseboard blocks. For instance, a single Quatech® 4-port block could be used whereby you send on port 1 and receive on port 2.