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.
Available since PCAN-Basic version 1.2.0.
It can be read without initialization since PCAN-Basic version 4.4.0.
This parameter can only be read. It cannot be modified.
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 |
Does not apply.
Get: It can be read on initialized or uninitialized PCAN Channels.
Set: It can be set on initialized PCAN Channels only.
The following code shows how to retrieve the controller number of a USB Channel:
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}");
}
}Dim channelsToCheck As PcanChannel() = {PcanChannel.Usb01, PcanChannel.Usb02, PcanChannel.Usb03, PcanChannel.Usb04}
Dim controllerNumber As UInteger
For i = 0 To 3
If Api.GetValue(channelsToCheck(i), PcanParameter.ControllerNumber, controllerNumber) = PcanStatus.OK Then
Console.WriteLine($"{channelsToCheck(i)} physical channel index: {controllerNumber}")
End If
Nextarray<PcanChannel>^ channelsToCheck = { PcanChannel::Usb01, PcanChannel::Usb02, PcanChannel::Usb03, PcanChannel::Usb04 };
UInt32 controllerNumber;
for (int i = 0; i < 4; i++)
{
if (Api::GetValue(channelsToCheck[i], PcanParameter::ControllerNumber, controllerNumber) == PcanStatus::OK)
{
Console::WriteLine("{0} physical channel index: {1}", channelsToCheck[i], controllerNumber);
}
}