Main Content

Binary Encoding/Decoding Loopback Test (with Baseboard Blocks)

This model shows how to send Binary data over a serial link.

The transmitted data are: [8,5,170,1,N,170,2,44,M]. This byte stream contains two messages along with other elements.

  • The first byte, 8, is a count of the remaining number of bytes in the stream.

  • The second byte, 5, is an extraneous value (EV).

  • [170,1,N] is message 1 (M1).

  • [170,2,44,M] is message 2 (M2).

  • N and M are numbers between 0 and 255 that are incrementing and decrementing, respectively.

Notice that when the data contains extraneous bytes (5 in this case) the FIFO Read BINARY block can handle and ignore this extra information.

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_serialbaseboardbinarytest');

See Also