Main Content

j1939Channel

Create J1939 CAN channel

Description

example

j1939Ch = j1939Channel(database,'vendor','device') creates a J1939 channel connected to the specified CAN device. Use this syntax for National Instruments™ and PEAK-System devices, which do not require a channel index argument.

example

j1939Ch = j1939Channel(database,'vendor','device',chanIndex) creates a J1939 CAN channel connected to the specified CAN device and channel index. Use this syntax for Vector and Kvaser devices that support a channel index specifier.

Examples

collapse all

Specify a database.

db = canDatabase('C:\J1939DB.dbc');

Create the channel object.

j1939Ch = j1939Channel(db,'Vector','Virtual 1',1)
j1939Ch = 

  Channel with properties:

   Device Information:
   -------------------
                  DeviceVendor: 'Vector'
                        Device: 'Virtual 1'
            DeviceChannelIndex: 1
            DeviceSerialNumber: 0

   Data Details:
   -------------
      ParameterGroupsAvailable: 0
       ParameterGroupsReceived: 0
    ParameterGroupsTransmitted: 0
                FilterPassList: []
               FilterBlockList: []

   Channel Information:
   --------------------
                       Running: 0
                     BusStatus: 'N/A'
          InitializationAccess: 1
              InitialTimestamp: [0×0 datetime]
                    SilentMode: 0
               TransceiverName: ''
              TransceiverState: 0
                      BusSpeed: 500000
                           SJW: 1
                         TSEG1: 4
                         TSEG2: 3
                  NumOfSamples: 1

   Other Information:
   ------------------
                      UserData: []

Specify a database.

db = canDatabase('C:\J1939DB.dbc');

Create the channel object.

j1939Ch = j1939Channel(db,'NI','CAN1');

Input Arguments

collapse all

CAN database specified as a CAN database object. The specified database contains J1939 parameter group definitions.

Example: database = canDatabase('C:\database.dbc')

Name of device vendor, specified as a character vector or string.

Example: 'Vector'

Data Types: char | string

Name of CAN device attached to the J1939 CAN channel, specified as a character vector or string.

For Kvaser and Vector products, device is a combination of the device type and a device index. For example, a Kvaser device might be 'USBcanProfessional 1'; if you have two Vector CANcardXL devices, device can be 'CANcardXL 1' or 'CANcardXL 2'.

For National Instruments devices the devicenumber is the interface number defined in the NI Measurement & Automation Explorer.

For PEAK-System devices the devicenumber is the alphanumeric device number defined for the channel.

Example: 'Virtual 1'

Data Types: char | string

Channel number of the CAN device attached to the J1939 CAN channel, specified as a numeric value. Use this argument with Kvaser and Vector devices.

Example: 1

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

J1939 CAN channel returned as a j1939.Channel object, with j1939.Channel Properties.

Version History

Introduced in R2015b