Main Content

ASCII Encoding/Decoding Loopback Test (With Baseboard Blocks)

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

The ASCII Encode block generates a message with three different sub messages along with some extraneous data to show how the FIFO Read HDRS block can remain synchronized to the valid byte stream even in the presence of transmission errors.

The FIFO Read HDRS block can handle an arbitrary number of headers; just add them as strings to the cell array in the block parameters dialog box. The messages must share the same termination string. In this example, it is a carriage return followed by a line feed: "\r\n".

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 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(fullfile(matlabroot,'toolbox','slrealtime','examples','slrt_ex_serialbaseboardasciitest'))

See Also