target.TargetConnection Class
Namespace: target
Description
Use the target.TargetConnection
class, which inherits functionality
from target.Connection
, to provide details about connecting your
MATLAB® computer to target hardware. For example, the communication channel and
connection properties that are required for communication with your target hardware.
To create a target.TargetConnection
object, use the target.create
function. Create the object and then use separate steps to specify
properties. Or, using name-value arguments, create the object and specify properties in a
single step.
Properties
Name
— Connection object
character vector | string
Name of connection object.
Attributes:
GetAccess | public |
SetAccess | public |
CommunicationChannel
— Communication channel type
target.CommunicationChannel
object
Associate a target.CommunicationChannel
object with your
connection, which describes the type of channel that is used. For example, to specify
serial or TCP channel properties, use target.RS232Channel
or
target.TCPChannel
respectively.
If you use name-value arguments to create a
target.TargetConnection
object, for the
CommunicationChannel
property, specify these
arguments.
Name | Description |
---|---|
'CommunicationType' | Required. Type of predefined communication channel. Specifies one of these values:
|
'IPAddress' | Optional. If predefined communication channel is |
'Port' | Optional. If predefined communication channel is
|
'BaudRate' | Optional. If predefined communication channel is
|
'Parity' | Optional. If predefined communication channel is
|
Attributes:
GetAccess | public |
SetAccess | public |
Target
— Connected target
target.Board
object
Associate a target.Board
object with your connection, which
describes the target hardware that is connected to the MATLAB computer.
Attributes:
GetAccess | public |
SetAccess | public |
ConnectionProperties
— MATLAB computer connection properties
target.ConnectionProperties
object
Associate a target.ConnectionProperties
object with your
connection that describes the MATLAB computer connection properties that are used to connect to the target
hardware. For example, to specify the serial port, use a target.Port
object.
If you use name-value arguments to create a
target.TargetConnection
object and the predefined communication
channel type is 'RS232Channel'
, specifying the argument
'Port'
sets the ConnectionProperties
property to
target.Port
.
Attributes:
GetAccess | public |
SetAccess | public |
TargetConnectionProperties
— Target connection properties
target.ConnectionProperties
object
Associate a target.ConnectionProperties
object with your
connection that describes the target hardware connection properties that are used to
connect to the MATLAB computer. For example, to specify the serial port, use a
target.Port
object.
If you use name-value arguments to create a
target.TargetConnection
object and the predefined communication
channel type is 'RS232Channel'
, specifying the argument
'Port'
sets the TargetConnectionProperties
property to target.Port
.
Attributes:
GetAccess | public |
SetAccess | public |
Examples
Specify Connection Between Development Computer and Target Hardware
This code from Set Up PIL Connectivity by Using Target Framework shows how to
specify the connection between your development computer and target hardware. In the
example, the target application runs on your development computer as a separate process
and uses a TCP communication channel through localhost
.
connection = target.create('TargetConnection'); connection.Name = 'Host Process Connection'; connection.Target = hostTarget; connection.CommunicationChannel = target.create('TCPChannel'); connection.CommunicationChannel.Name = ... 'External Process TCPCommunicationChannel'; connection.CommunicationChannel.IPAddress = 'localhost'; connection.CommunicationChannel.Port = '0';
Note
Using name-value arguments, you can create the connection object with this command:
connection = target.create('TargetConnection', ... 'Name', 'Host Process Connection', ... 'Target', hostTarget, ... 'CommunicationType', 'TCPChannel', ... 'IPAddress', 'localhost', ... 'Port', '0')
Version History
Introduced in R2020b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)