Documentation Center

  • Trial Software
  • Product Updates

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 as defined below.

  • 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 incremenenting 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. Scope 3 shows the transmitted byte stream. The gain block on the signal to Scope 3 makes the elements of the vector non-virtual so the scope can see them.

To test this model:

  1. The target computer must have two COM ports.

  2. 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.

Was this topic helpful?