Serial Communication

Serial Communication Overview

Before you can create and run a target application, you need to set up the connection between your host and target computers. You can use either serial or network communication.

For network communication, see Network Communication.

Hardware for Serial Communication

Before you install the xPC Target™ software and configure it for serial communication, you must install the following hardware:

Null Model Cable Wiring

xPC Target software ships with a null modem cable that you can use to connect the host and target computers for serial communications. The following diagram illustrates the wiring for this cable for a 9-pin DB9 connector.

Environment Properties for Serial Communication

The xPC Target environment is defined by a group of properties. These properties give to the xPC Target software information about the software and hardware products that it works with. You might change some of these properties often, while others you will rarely want to change.

After you have installed the xPC Target product, you can specify the environment properties for the host and target computers. Note that you must specify these properties before you can build and download a target application.

The following procedure describes how to set up serial communication environment properties through the xPC Target Explorer.

Note the following:

  1. If xPC Target Explorer is not already started, in the MATLAB® Command Window, type

    xpcexplr

    The xPC Target Explorer window opens. Note that xPC Target Explorer automatically provides a default target PC node, TargetPC1.

    xPC Target Explorer associates serial communication environment properties with the target PC.

  2. In the xPC Target Explorer, right-click the Host PC node.

  3. Select Add Target.

    A target PC node, named TargetPC2, appears in the xPC Target Hierarchy, at the same level as the Host PC node. It appears with the icon (note the X to denote that the host PC is not connected to the target PC).

  4. As necessary, repeat step 2 and step 3 for each additional target PC you want to add to your system.

    Additional target PC nodes appear in the xPC Target Hierarchy. As you add other target PCs, the PC number is incremented. The following figure illustrates two target PC nodes.

  5. In the xPC Target Explorer, expand a target PC node.

    Configuration, File System, and PCI Devices nodes appear. You work with the Configuration node to configure the target PC node for a target PC. The File System node contains the contents of a target PC file system. PCI Devices lists all PCI devices detected on the target PC. In this procedure, you work with the Configuration node.

    Under the Configuration node are nodes for Communication, Settings, and Appearance. The parameters for the target PC node are grouped in these categories. These nodes make up the target environment settings.

  6. Select Communication.

    The Communication Component pane appears to the right.

  7. From the Host target communication list, select RS232.

    The pane changes to one that contains only those parameters pertinent to serial communication.

  8. From the Host port list, select either COM1 or COM2 for the connection on the host PC. The xPC Target software determines the COM port you use on the target PC automatically.

  9. From the Baud rate list, select the baud rate for the serial connection between the host PC and this target PC. The default is 115200. Note that for optimal performance, you should select the highest possible serial connection baud rate for the xPC Target software.

  10. Repeat step 5 to step 9 for any target PC for which you have a serial connection between the host PC and target PC.

    The following figure illustrates the xPC Target Explorer settings for the serial connection of one target PC.

You do not have to exit and restart MATLAB after making changes to the xPC Target environment, even if you change the communication between the host and target from RS-232 to TCP/IP. However, you do have to recreate the target boot disk and rebuild the target application from the Simulink® model.

For more information on the xPC Target environment, see Software Environment and Demos in the xPC Target User's Guide.

Your next task is to create a target boot disk. See Target Boot Disk.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS