ControllerNumber

This parameter is used to identify the physical CAN channel index of a multichannel CAN hardware (PCAN-PCI, PCAN-USB Pro, PCAN-LAN, etc.). This index is zero-based, so that the first channel on a device is 0, the second 1, and so on.

This parameter can be used to determine which physical channel of a multichannel PCAN device has to be connected.

Availability

Available since PCAN-Basic version 1.2.0.

It can be read without initialization since PCAN-Basic version 4.4.0.

Supported By

Access Mode

This parameter can only be read. It cannot be modified.

Possible Values

A number in the range [0…n-1], where n is the number of physical channels on the device being used. The correspondence between an index number and the CAN channel description on the hardware etiquette is:

Channel Index

Channel Label

0

CAN 1

1

CAN 2

n-1

CAN n

Default Value

Does not apply.

Initialization Status

Get: It can be read on initialized or uninitialized PCAN Channels.

Set: It can be set on initialized PCAN Channels only.

Example

The following code shows how to retrieve the controller number of a USB Channel:

C#
PcanChannel[] channelsToCheck = { PcanChannel.Usb01, PcanChannel.Usb02, PcanChannel.Usb03, PcanChannel.Usb04 };
uint controllerNumber;

for (int i = 0; i < 4; i++)
{
    if (Api.GetValue(channelsToCheck[i], PcanParameter.ControllerNumber, out controllerNumber) == PcanStatus.OK)
    {
        Console.WriteLine($"{channelsToCheck[i]} physical channel index: {controllerNumber}");
    }
}

See Also