When using multiple devices at the same time, it is necessary to initialize
each device and obtain a different ID.
Execute functions by specifying the ID of each device. At the time of termination,
perform termination processing for each device.
Here is an example of using multiple devices.
Use two CAN-4P-PE and one CAN-4PF-PE, and
each device is set to the following device name.
The variables that store the ID of each device are ID_CAN1, ID_CAN2, ID_CANFD1.
CAN-4P-PE 1st: CAN000
CAN-4P-PE 2nd: CAN001
CAN-4PF-PE : CAN002
Visual Basic .NET
Device |
CAN-4P-PE 1st |
CAN-4P-PE 2nd |
CAN-4PF-PE |
DeviceName |
CAN000 |
CAN001 |
CAN002 |
ID Declaration |
Dim ID_CAN1 As Integer |
Dim ID_CAN2 As Integer |
Dim ID_CANFD1 As Integer |
Init |
Ret = CanInit("CAN000" ,ID_CAN1) |
Ret = CanInit("CAN001" ,ID_CAN2) |
Ret = CanInit("CAN002" ,ID_CANFD1) |
Other Functions |
Ret = Can***( ID_CAN1, *** ) |
Ret = Can***( ID_CAN2, *** ) |
Ret = Can***( ID_CANFD1, *** ) |
Visual C#
Device |
CAN-4P-PE 1st |
CAN-4P-PE 2nd |
CAN-4PF-PE |
DeviceName |
CAN000 |
CAN001 |
CAN002 |
ID Declaration |
short ID_CAN1; |
short ID_CAN2; |
short ID_CANFD1; |
Init |
Ret = can.Init("CAN000" ,out ID_CAN1); |
Ret = can.Init("CAN001" ,out ID_CAN2); |
Ret = can.Init("CAN002" ,out ID_CANFD1); |
Other Functions |
Ret = can.***( ID_CAN1, *** ); |
Ret = can.***( ID_CAN2, *** ); |
Ret = can.***( ID_CANFD1, *** ); |
Visual C++ (MFC)
Device |
CAN-4P-PE 1st |
CAN-4P-PE 2nd |
CAN-4PF-PE |
DeviceName |
CAN000 |
CAN001 |
CAN002 |
ID Declaration |
short ID_CAN1; |
short ID_CAN2; |
short ID_CANFD1; |
Init |
Ret = CanInit("CAN000" ,&ID_CAN1); |
Ret = CanInit("CAN001" ,&ID_CAN2) |
Ret = CanInit("CAN002" ,&ID_CANFD1); |
Other Functions |
Ret = Can***( ID_CAN1, *** ); |
Ret = Can***( ID_CAN2, *** ); |
Ret = Can***( ID_CANFD1, *** ); |
Python
Device |
CAN-4P-PE 1st |
CAN-4P-PE 2nd |
CAN-4PF-PE |
DeviceName |
CAN000 |
CAN001 |
CAN002 |
ID Declaration |
ID_CAN1 = ctypes.c_short() |
ID_CAN2 = ctypes.c_short() |
ID_CANFD1 = ctypes.c_short() |
Init |
Ret.value = ccan.CanInit ( b"CAN000" , ctypes.byref(ID_CAN1)) |
Ret.value = ccan.CanInit ( b"CAN001" , ctypes.byref(ID_CAN2)) |
Ret.value = ccan.CanInit( b"CAN002" , ctypes.byre(ID_CANFD1)) |
Other Functions |
Ret.value = ccan.Can***( ID_CAN1, *** ) |
Ret.value = ccan.Can***( ID_CAN2, *** ) |
Ret.value = ccan.Can***( ID_CANFD1, *** ) |