When using multiple PCAN-USB adapters together with PCAN-Basic on the same machine it is possible to connect a certain device ID with a hardware handle so that access to a specific unit is independent from the sequence these adapters are plugged into the USB ports. The following steps must be taken to accomplish that:
Each PCAN-USB-Hardware (PCAN-USB, PCAN-USB ISO, PCAN-USB Pro, PCAN-HUB) has a DeviceID (by default this is FFh). This DeviceID can be changed using the current version of PCAN-View (see screenshot below).
Make sure that you assign unique IDs for each of the adapters connected to the same machine, don't duplicate the same device ID because then this entire process will not work.
After changing the DeviceID a few values must be added/created in the Registry.
Here is a small example using 3 USB adapters with the following DeviceIDs:
1. USB-Adapter = 0x01h
2. USB-Adapter = 0x02h
3. USB-Adapter = 0x05h
The following keys must be created:
Description of Parameter 1:
Hardware16 = HardwareHandle16
Hardware15 = HardwareHandle 15
Hardware8 = HardwareHandle8
Hardware1 = HardwareHandle1
Description of Parameter 2:
0x201 = PCAN-USB and PCAN-USB ISO
0x202 = PCAN-USB Pro
0x203 = PCAN-USB HUB
Description of Parameter 3:
the corresponding (selected) DeviceID
0x00 = don´t care
0x01 through 0xff
In our little example we must use 0x01, 0x02 and 0x05
Description of Parameter 4 (only applicable for USB-PRO, because there we can have 1 DeviceID with 2 CANchannels per device):
0 = Channel 1
1 = Channel 2
When using PnP (Plug&Play) devices the hardware handle is usually assigned starting at 16 and then counting down.
This means the first USB-Adapter will get Hardware-Handle16, the second adapter gets HardwareHandle15, the third Adapter HardwareHandle14 etc.
With PCAN-Basic the application that is started first uses Handle "PCAN_USBBUS1" = 0x51, the application that is started next will use Handle "PCAN_USBBUS2" = 0x52 etc..
This results in the following assignment scheme:
HardwareHandle 16 -> PCAN_USBBUS1 0x51
HardwareHandle 15 -> PCAN_USBBUS2 0x52
HardwareHandle 14 -> PCAN_USBBUS3 0x53
The application that is started first will always connect to the adapter with ID01h, the second application connects to the adapter with ID02h and the third application connects to the adapter with ID05h.
PS: Thanks to René from Phytec America