| Contents | Index |
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.
See Target Environment Command-Line Interface for a description of how you can manage multiple target computer environments through the MATLAB interface. Alternatively, if you have only one target computer, you can use the function getxpcenv to list the environment variables for the default target computer environment.
To enter properties specific to your model and its build procedure, see Entering Simulation 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. To get a list of the property names, their allowed values, and their current values, for a specific target computer, TargetPC2.
In the MATLAB Command Window, type
tgs=xpctarget.targets
tgEnv=tgs.Item('TargetPC2')The MATLAB interface displays a list of xPC Target environment properties and the current values. For a list of the properties, see the function xpctarget.env.get (env object).
Alternatively, you can use the xPC Target Explorer window to view and change environment properties.
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 computer 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 computer. The most important node is the TargetPC node. Each time you add a target computer 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 computer 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 target computer-specific configuration pane. If your license does not include the xPC Target Embedded Option™ product, you can choose Boot Floppy, CD Boot, DOS Loader, or Network Boot. With the xPC Target Embedded Option license, you have the additional choice of 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 computers, see Configuring Environment Parameters for Target Computers.
You can optionally configure the environment parameters for the target computer node in your xPC Target system. This section assumes that
You have already added target computer nodes to your system.
You have already configured the communication parameters between the host computer and the target computer.
In the xPC Target Explorer, expand a target computer node.
A Configuration node appears. Under this are nodes for Communication, Settings, and Appearance. The parameters for the target computer 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 computer.
This field defines the total amount of installed RAM in the target computer. 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 computer 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 Boot Floppy, DOSLoader, or Network Boot 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 computer has a 386 or 486 compatible processor. If your target computer has a Pentium or higher compatible processor, selecting this check box will slow the performance of your target computer.
By default, the Multicore CPU support check box is cleared. You can select this check box if your target computer has multicore processors and you want to take advantage of them. If you also want to enable multirate models to take advantage of target computers, see Configuring Models for Targets with Multicore Processors.
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 computer displays information as text. To use all the features of the target scope, you also need to install a keyboard on the target computer.
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 a MATLAB code script that accesses the environment settings according to your own needs. For example, you could write a script that switches between two targets.
To change the COM port property for your host computer from COM1 to COM2:
tgs=xpctarget.targets
tgEnv=tgs.Item('TargetPC2')
set(tgEnv,'RS232HostPort','COM2')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 a MATLAB code script that accesses the environment settings according to your own needs. For example, you could write a script that switches between two targets.
To change the COM port property for your host computer from COM1 to COM2:
setxpcenv('RS232HostPort','COM2')
![]() | Target Environment Command-Line Interface | Configuring Environment From the MATLAB Command Line | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |