This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Access XCP A2L Files

This example shows how to access information stored in A2L files for use with XCP connections. It uses a freely available XCP slave simulator from Vector and Vector Virtual CAN channels.

Run a Slave Simulator

This example requires installing a free, third-party XCP implementation from Vector. The package includes an XCP slave simulator and A2L file. To install this driver, please follow these instructions:

  1. Go to and navigate to the "DOWNLOADS" page.

  2. Search for "Demos" under "Categories" and "XCP" under "Standards".

  3. Download and install the available version of "XCP Sample Implementation".

  4. In MATLAB, navigate to where you installed the sample package, and then go to .\Samples\XCPSim\CANape.

  5. The MATLAB XCP examples will use the XCPSIM.a2l file and the XCPsim.exe slave simulator. Run XCPsim.exe.

Open an A2L File

Open an A2L file to parse and inspect the contents and make it usable for subsequent XCP activities.

a2lObj = xcpA2L('XCPSIM.a2l')
a2lObj = 

  A2L with properties:

                 FileName: 'XCPSim.a2l'
                 FilePath: [1x65 char]
                SlaveName: 'CPP'
        ProtocolLayerInfo: [1x1 struct]
                  DAQInfo: [1x1 struct]
    TransportLayerCANInfo: [1x1 struct]
                   Events: {1x6 cell}
             Measurements: {1x38 cell}

Inspect A2L Information

The properties of the A2L file object allow you to inspect the many configuration parameters contained within the file. Of special note is the Measurements property which contains the names of all available measurements for use in DAQ/STIM lists.

ans = 

  Columns 1 through 5

    'BitSlice'    'BitSlice0'    'BitSlice1'    'BitSlice2'    'Counter_B4'

  Columns 6 through 10

    'Counter_B5'    'Counter_B6'    'Counter_B7'    'FW1'    'KL1Output'

  Columns 11 through 15

    'PWM'    'PWMFiltered'    'PWM_Level'    'ShiftByte'    'Shifter_B0'

  Columns 16 through 20

    'Shifter_B1'    'Shifter_B2'    'Shifter_B3'    'TestStatus'    'Triangle'

  Columns 21 through 26

    'ampl'    'bit12Counter'    'byte1'    'byte2'    'byte3'    'byte4'

  Columns 27 through 30

    'byteCounter'    'bytePWMFilter'    'channel3'    'dwordCounter'

  Columns 31 through 35

    'map1InputX'    'map1InputY'    'map1Output'    'period'    'sbytePWMLevel'

  Columns 36 through 38

    'v'    'vin'    'wordCounter'

Query for Event Information

Use the getEventInfo command to retrieve detailed information about an event by name.

getEventInfo(a2lObj, '10 ms')
ans = 

                         Name: '10 ms'
                    Direction: 'DAQ_STIM'
                   MaxDAQList: 255
                ChannelNumber: 1
             ChannelTimeCycle: 10
              ChannelTimeUnit: 6
              ChannelPriority: 0
    ChannelTimeCycleInSeconds: 0.0100

Query for Measurement Information

Use the getMeasurementInfo command to retrieve detailed information about a measurement by name.

getMeasurementInfo(a2lObj, 'Triangle')
ans = 

                   Name: 'Triangle'
         LongIdentifier: 'Triangle test signal used for PWM output PWM'
               DataType: 'SBYTE'
             Conversion: 'BitSlice.CONVERSION'
             Resolution: 0
               Accuracy: 0
             LowerLimit: -50
             UpperLimit: 50
             ECUAddress: 4951377
    ECUAddressExtension: 0
              ByteOrder: 'MSB_LAST'
            SizeInBytes: 1
          SizeInNibbles: 2
             SizeInBits: 8
             MATLABType: 'int8'

Was this topic helpful?