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: 'H:\Documents\work\XCPSIM.a2l'
                SlaveName: 'CPP'
        ProtocolLayerInfo: [1x1 struct]
                  DAQInfo: [1x1 struct]
    TransportLayerCANInfo: [1x1 struct]
                   Events: {'Key T'  '10 ms'  '100ms'  '1ms'  'FilterBypassDaq'  'FilterBypassSt'}
             Measurements: {1x38 cell}

View all available measurements:

a2lfile.Measurements
ans = 

  Columns 1 through 8

    'BitSlice'    'BitSlice0'    'BitSlice1'    'BitSlice2'    'Counter_B4'    'Counter_B5'    'Counter_B6'    'Counter_B7'

  Columns 9 through 16

    'FW1'    'KL1Output'    'PWM'    'PWMFiltered'    'PWM_Level'    'ShiftByte'    'Shifter_B0'    'Shifter_B1'

  Columns 17 through 25

    'Shifter_B2'    'Shifter_B3'    'TestStatus'    'Triangle'    'ampl'    'bit12Counter'    'byte1'    'byte2'    'byte3'

  Columns 26 through 33

    'byte4'    'byteCounter'    'bytePWMFilter'    'channel3'    'dwordCounter'    'map1InputX'    'map1InputY'    'map1Output'

  Columns 34 through 38

    'period'    'sbytePWMLevel'    'v'    'vin'    'wordCounter'

Get information about the BitSlice measurement:

getMeasurementInfo(a2lfile,'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'

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: 'H:\Documents\work\XCPSIM.a2l'
                SlaveName: 'CPP'
        ProtocolLayerInfo: [1x1 struct]
                  DAQInfo: [1x1 struct]
    TransportLayerCANInfo: [1x1 struct]
                   Events: {'Key T'  '10 ms'  '100ms'  '1ms'  'FilterBypassDaq'  'FilterBypassSt'}
             Measurements: {1x38 cell}

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