按照Matlab帮助中心方法后:
以下示例说明如何访问存储在 A2L 文件中的信息以用于 XCP 连接。它使用 Vector 免费提供的 XCP 从站仿真器。
运行从站仿真器
此示例需要安装 Vector 提供的免费第三方 XCP 实现。该包包括 XCP 从站仿真器和 A2L 文件。要安装此驱动程序,请按照以下说明进行操作:
访问 www.vector.com 并导航到“DOWNLOADS”页面。
在“Categories”下搜索“Demos”,在“Standards”下搜索“XCP”。
下载并安装“XCP Sample Implementation”的可用版本。
在 MATLAB 中,导航到安装示例包的位置,然后转至 .\Samples\XCPSim\CANape。
MATLAB XCP 示例将使用 XCPSIM.a2l 文件和 XCPsim.exe 从站仿真器。运行 XCPsim.exe。
Matlab显示结果应该如下:
打开 A2L 文件
打开一个 A2L 文件以解析和检查内容,并使其可用于后续 XCP 活动。
a2lObj = xcpA2L('XCPSIM.a2l')
a2lObj = A2L with properties: FileName: 'XCPSIM.a2l' FilePath: '\\central-mi\home\jpyle\documents\MATLAB\examples\vnt-ex15095408\XCPSIM.a2l' SlaveName: 'CPP' ProtocolLayerInfo: [1×1 xcp.ProtocolLayerInfo] DAQInfo: [1×1 xcp.DAQInfo] TransportLayerCANInfo: [1×1 xcp.TransportLayerCANInfo] TransportLayerUDPInfo: [1×1 xcp.TransportLayerUDPInfo] TransportLayerTCPInfo: [] Events: {1×6 cell} Measurements: {1×45 cell} Characteristics: {1×16 cell} EventInfo: [1×6 xcp.Event] MeasurementInfo: [45×1 containers.Map] CharacteristicInfo: [16×1 containers.Map] AxisInfo: [1×1 containers.Map] RecordLayouts: [41×1 containers.Map] CompuMethods: [16×1 containers.Map] CompuTabs: [0×1 containers.Map] CompuVTabs: [2×1 containers.Map]
但是实际结果如下:
a2lObj = xcpA2L('XCPSIM.a2l')
a2lObj =
A2L - 属性:
FileName: 'XCPSIM.a2l'
FilePath: 'D:\program\XCP\Samples\XCPsim\CANape\XCPSIM.a2l'
SlaveName: 'CPP'
ProtocolLayerInfo: [1×1 struct]
DAQInfo: [1×1 struct]
TransportLayerCANInfo: [1×1 struct]
TransportLayerUDPInfo: [1×1 struct]
TransportLayerTCPInfo: [0×0 struct]
Events: {1×6 cell}
Measurements: {1×42 cell}
缺少很多信息。