| xPC Target™ | ![]() |
The xPC Target™ environment defines the connections and communication between the host and target computers. It also defines the build process for a real-time application. You can define the xPC Target environment through either the MATLAB® interface or xPC Target Explorer. The xPC Target environment provides a number of demos that help you understand the product.
Refer to the function getxpcenv to list the environment variables for the default target PC environment. See Working with Target PC Environments for a description of how you can manage multiple target PC environments through the MATLAB interface.
To enter properties specific to your model and its build procedure, see Entering the Real-Time Workshop® Parameters in the xPC Target™ Getting Started Guide. These properties are saved with your Simulink® model.
To use the xPC Target functions to change environment properties, you need to know the names and allowed values of these properties. Use the following procedure to get a list of the property names, their allowed values, and their current values:
In the MATLAB Command Window, type
setxpcenv
The MATLAB interface displays a list of xPC Target environment properties and the allowed values. For a list of the properties, see the function getxpcenv.
getxpcenv
The MATLAB interface displays a list of xPC Target environment properties and the current values.
Alternatively, you can use the xPC Target Explorer window to view and change environment properties.
The xPC Target software lets you define and change environment properties. These properties include the path to the C/C++ compiler, the host PC COM port, the logging buffer size, and many others. Collectively these properties are known as the xPC Target environment.
To change an environment property using the xPC Target GUI, xPC Target Explorer, use the following procedure:
xpcexplr
The MATLAB interface opens the xPC Target Explorer window.

Note the contents of the left pane. This is the xPC Target Hierarchy pane.
This pane contains all the objects in your xPC Target hierarchy. As you add objects to your system, xPC Target Explorer adds their corresponding nodes to the xPC Target Hierarchy pane. The most important node is the HostPC node. It represents the host PC. The most important node is the TargetPC node. Each time you add a target PC node to xPC Target Explorer, a corresponding node is added to the xPC Target Hierarchy pane, starting with TargetPC1 and incrementing with the addition of each new target PC node.
The right pane displays information about the item selected in the left pane. This pane also displays xPC Target environment properties for the HostPC and TargetPC nodes. You edit these properties in the right pane.
To change the size of the left or right pane, select and move the divider between the panes left or right.
The Configuration node under the Target PC node has the property Target boot mode. If your license does not include the xPC Target Embedded Option™ product, the Target boot mode box is grayed out, with BootFloppy as your only selection. With the xPC Target Embedded Option license, you have the additional choices of DOSLoader and StandAlone.
Change properties in the environment in the right pane by entering new property values in the text boxes or choosing items from the lists.
xPC Target Explorer applies changes to the environment properties as soon as you make them in the right pane.
To change environment properties for target PCs, see Configuring Environment Parameters for Target PCs.
You can optionally configure the environment parameters for the target PC node in your xPC Target system. This section assumes that
You have already added target PC nodes to your system.
You have already configured the communication parameters between the host PC and the target PC.
Note In general, the default values of these parameters are sufficient for you to use the xPC Target software. |
In the xPC Target Explorer, expand a target PC node.
A Configuration node appears. Under this are nodes for Communication, Settings, and Appearance. The parameters for the target PC node are grouped in these categories.
The Settings Component pane appears to the right.
In the Target RAM size (MB) field, enter
Auto — The target kernel automatically attempts to determine the amount of memory.
Manual — The amount of RAM, in MB, installed on the target PC.
This field defines the total amount of installed RAM in the target PC. The RAM is used for the kernel, target application, data logging, and other functions that use the heap.
From the Maximum model size list, select either 1 MB, 4 MB, or 16 MB. Choosing the maximum model size reserves the specified amount of memory on the target PC for the target application. The remaining memory is used by the kernel and by the heap for data logging. Note that this parameter is only available for StandAlone mode. You cannot specify a maximum model size for BootFloppy and DOSLoader modes. These modes allow the loading of arbitrarily-sized target applications.
By default, the Enable secondary IDE check box is not selected. Select this check box only if you want to use the disks connected to a secondary IDE controller. If you do not have disks connected to the secondary IDE controller, do not select this check box.
By default, the Target PC is a 386/486 check box is not selected. You must select this check box if your target PC has a 386 or 486 compatible processor. If your target PC has a Pentium or higher compatible processor, selecting this check box will slow the performance of your target PC.
In the xPC Target Hierarchy pane, select Appearance.
The Appearance Component pane appears to the right.
From the Target scope list, select either Enabled or Disabled. The property Target scope is set by default to Enabled. If you set Target scope to Disabled, the target PC displays information as text. To use all the features of the target scope, you also need to install a keyboard on the target PC.
The xPC Target software lets you define and change different properties. These properties include the path to the C/C++ compiler, the host COM port, the logging buffer size, and many others. Collectively these properties are known as the xPC Target environment.
You can use the command-line functions to write an M-file script that accesses the environment settings according to your own needs. For example, you could write an M-file that switches between two targets.
The following procedure shows how to change the COM port property for your host PC from COM1 to COM2:
setxpcenv('RS232HostPort','COM2')The up-to-date column shows the values that you have changed, but have not updated.
HostTargetComm | :RS232 | up to date |
Making changes using the function setxpcenv does not change the current values until you enter the update command.
updatexpcenv
The environment properties you changed with the function setxpcenv become the current values.
HostTargetComm | :RS232 | up to date |
![]() | Software Environment and Demos | xPC Target™ Demos | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |