Main Content

Inspect the Contents of an A2L File

Access an A2L File

To use an A2L file, create a file object in your MATLAB® session. At the Command Window prompt, type:

a2lfile = xcpA2L('filename.a2l')

Here a2lfile is a variable assigned with the A2L object, and filename.a2l is the name of your A2L file. If your A2L file is not in the current working directory, specify the necessary partial or full path to the file:

a2lfile = xcpA2L('path\filename.a2l');

Tip

A2L file names containing non-alphanumeric characters such as equal signs or ampersands are not supported. You can use periods in your database name. Rename any A2L files with non-alphanumeric characters before you use them.

This command returns an A2L object that you can use for live communication with a slave module using XCP channels.

Access Measurement Information

This example shows how to open an A2L file and access measurement information.

Open an A2L file:

a2lfile = xcpA2L('XCPSIM.a2l');

Display properties of the A2L object:

a2lfile
  A2L with properties:

                 FileName: 'XCPSIM.a2l'
                 FilePath: 'C:\work\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: {'Key T'  '10 ms'  '100ms'  '1ms'  'FilterBypassDaq'  'FilterBypassSt'}
             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]

View all available measurements:

a2lfile.Measurements
ans =

  1×45 cell array

  Columns 1 through 6

    {'BitSlice'}    {'BitSlice0'}    {'BitSlice1'}    {'BitSlice2'}    {'Counter_B4'}    {'Counter_B5'}

  Columns 7 through 12

    {'Counter_B6'}    {'Counter_B7'}    {'DtChannel1'}    {'FW1'}    {'KL1Output'}    {'MaxChannel1'}

  Columns 13 through 18

    {'MinChannel1'}    {'PWM'}    {'PWMFiltered'}    {'PWM_Level'}    {'ShiftByte'}    {'Shifter_B0'}

  Columns 19 through 24

    {'Shifter_B1'}    {'Shifter_B2'}    {'Shifter_B3'}    {'TestStatus'}    {'Triangle'}    {'ampl'}

  Columns 25 through 31

    {'bit12Counter'}    {'byte1'}    {'byte2'}    {'byte3'}    {'byte4'}    {'byteCounter'}    {'bytePWMFilter'}

  Columns 32 through 37

    {'channel1'}    {'channel2'}    {'channel3'}    {'dwordCounter'}    {'limit'}    {'map1InputX'}

  Columns 38 through 44

    {'map1InputY'}    {'map1Output'}    {'offset'}    {'period'}    {'sbytePWMLevel'}    {'v'}    {'vin'}

  Column 45

    {'wordCounter'}

Get information about the 'Triangle' measurement:

getMeasurementInfo(a2lfile,'Triangle')
ans = 

  Measurement with properties:

             Resolution: 0
               Accuracy: 0
            LocDataType: 'SBYTE'
                 Layout: 'ROW_DIR'
                   Name: 'Triangle'
         LongIdentifier: 'Triangle test signal used for PWM output PWM'
             ECUAddress: 4951377
    ECUAddressExtension: 0
             Conversion: [1×1 xcp.CompuMethodRational]
              Dimension: 1
             LowerLimit: -50
             UpperLimit: 50
                BitMask: []

Access Event Information

This example shows how to open an A2L file and access event information.

Open an A2L file:

a2lfile = xcpA2L('XCPSIM.a2l');

Display properties of the A2L object:

a2lfile
  A2L with properties:

                 FileName: 'XCPSIM.a2l'
                 FilePath: 'C:\work\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: {'Key T'  '10 ms'  '100ms'  '1ms'  'FilterBypassDaq'  'FilterBypassSt'}
             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]

View all available events:

a2lfile.Events
ans = 

    'Key T'    '10 ms'    '100ms'    '1ms'    'FilterBypassDaq'    'FilterBypassSt'

Get information for the '10 ms' event:

 getEventInfo(a2lfile,'10 ms')
ans = 

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

See Also

Functions