xcpChannel

Create XCP channel

Description

example

xcpch = xcpChannel(a2lFile,'CAN',vendor,deviceID) creates a channel connected to the CAN bus via the specified vendor and device. The XCP channel accesses the slave module via the CAN bus, parsing the attached A2L file.

Use this syntax for vendor 'PEAK-System' or 'NI'. With National Instruments® CAN devices, the deviceID argument must include the interface number defined for the channel in the NI Measurement & Automation Explorer.

example

xcpch = xcpChannel(a2lFile,'CAN',vendor,deviceID,deviceChannelIndex) creates a channel for the vendor 'Vector', 'Kvaser', or 'MathWorks'. Specify a numeric deviceChannelIndex for the channel.

example

xcpch = xcpChannel(a2lFile,'TCP',IPAddr,portNmbr) or xcpch = xcpChannel(a2lFile,'UDP',IPAddr,portNmbr) creates an XCP channel connected via Ethernet using TCP or UDP on the specified IP address and port.

Note

XCP communication over UDP or TCP assumes a generic Ethernet adaptor. It is not supported on Ethernet connections of devices from specific vendors.

xcpch = xcpChannel(a2lFile,'TCP') and xcpch = xcpChannel(a2lFile,'UDP') use the IP address and port number defined in the A2L file.

Examples

collapse all

Create an XCP channel using a Vector CAN module virtual channel.

Link an A2L file to your session.

a2l = xcpA2L('XCPSIM.a2l');

Create an XCP channel.

xcpch = xcpChannel(a2l,'CAN','Vector','Virtual 1',1)
xcpch = 

  Channel with properties:

               SlaveName: 'CPP'
             A2LFileName: 'XCPSIM.a2l'
          TransportLayer: 'CAN'
    TransportLayerDevice: [1x1 struct]
              SeedKeyDLL: []

Create an XCP channel for TCP communication via Ethernet.

Link an A2L file to your session.

a2l = xcpA2L('XCPSIM.a2l');

Create an XCP channel.

xcpch = xcpChannel(a2l,'TCP','10.255.255.255',80)
xcpch = 

   Channel with properties:

               SlaveName: 'CPP'
             A2LFileName: 'XCPSIM.a2l'
          TransportLayer: 'TCP'
    TransportLayerDevice: [1×1 struct]
              SeedKeyDLL: []

Input Arguments

collapse all

A2L file, specified as an xcp.A2L object, used in this connection. You can create an A2L file object using xcpA2L.

Device vendor name, specified as a character vector or string.

Example: 'Vector'

Data Types: char | string

Device on the interface to connect to, specified as a character vector or string.

For National Instruments CAN devices, this must include the interface number for the device channel, defined in the NI Measurement & Automation Explorer.

Example: 'Virtual 1'

Data Types: char | string

Index of channel on the device, specified as a numeric value.

Example: 1

IP address of the device, specified as a character vector or string

Example: '10.255.255.255'

Data Types: char | string

Port number for device connection, specified as a numeric value.

Example: 80

Output Arguments

collapse all

XCP channel, returned as an object.

See Also

Functions

Introduced in R2013a