xpctarget.xpc - Create target object representing target application

Syntax

MATLAB® command line

target_object = xpctarget.xpc('mode', 'arg1', 'arg2')
target_object=xpctarget.xpc('target_object_name')

Arguments

target_object

Variable name to reference the target object

mode

Optionally, enter the communication mode

 

TCPIP

Enable TCP/IP connection with target PC.

 

RS232

Enable RS-232 connection with target PC.

arg1

Optionally, enter an argument based on the mode value:

 

IP address

If mode is 'TCPIP', enter the IP address of the target PC.

 

COM port

If mode is 'RS232', enter the host COM port.

arg2

Optionally, enter an argument based on the mode value:

 

Port

If mode is 'TCPIP', enter the port number for the target PC.

 

Baud rate

If mode is 'RS232', enter the baud rate for the connection between the host and target PC.

target_object_name

Target object name as specified in the xPC Target™ Explorer

Description

Constructor of a target object. The target object represents the target application and target PC. You make changes to the target application by changing the target object using methods and properties.

If you have one target PC, or if you designate a target PC as the default one in your system, use the syntax

target_object=xpctarget.xpc

If you have multiple target PCs in your system, use the following syntax to create the additional target objects.

target_object=xpctarget.xpc('mode', 'arg1', 'arg2')

If you have a target PC object in the xPC Target Explorer, you can use the following syntax to construct a corresponding target object from the MATLAB Command Window.

target_object=xpctarget.xpc('target_object_name')

Examples

Before you build a target application, you can check the connection between your host and target computers by creating a target object, then using the targetping method to check the connection.

tg = xpctarget.xpc
	xPC Object
   		Connected            = Yes
   		Application          = loader

tg.targetping

	ans =

	success

If you have a second target computer for which you want to check the connection, create a second target object. In the following example, the connection with the second target computer is an RS-232 connection.

tg1=xpctarget.xpc('RS232','COM1','115200')

	xPC Object
   Connected            = Yes
   Application          = loader

If you have an xPC Target Explorer target object, and you want to construct a corresponding target object in the MATLAB Command Window, use a command like the following:

target_object=xpctarget.xpc('TargetPC1')

See Also

xPC Target methods get (target application object), set (target application object), delete, and targetping.

  


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