Retrieves the device ID, then the device can be accessed.
Ret = CanInit ( DeviceName , Id )
DeviceName
[ VB.NET: String ] [ C, C++: char * ] [ C#: string ] [ Python: ctypes.c_char_p
]
Specify the device name set in Device Manager.
Id
[ VB.NET: Short ] [ C, C++: short * ] [ C#: out short ] [ Python: ctypes.POINTER(ctypes.c_short)
]
A device ID is returned. By using this device ID, you can access the device
in the following functions.
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CAN_ERR_SUCCESS |
0 |
Normality completion |
CAN_ERR_INI_MEMORY |
3 |
Failed in the allocation of the memory. |
CAN_ERR_INI_REGISTRY |
4 |
Failed in the access of registry. |
CAN_ERR_INI_NOT_FOUND_SYS_FILE |
8 |
Initialization failed because ccan.sys is not found |
CAN_ERR_INI_DLL_FILE_VERSION |
9 |
Initialization failed because the file version of ccan.dll cannot be acquired |
CAN_ERR_INI_SYS_FILE_VERSION |
10 |
Initialization failed because the file version of ccan.sys cannot be acquired |
CAN_ERR_INI_NO_MATCH_DRV_VERSION |
11 |
Initialization failed because the file version of ccan.dll is not same as ccan.sys |
CAN_ERR_DLL_DEVICE_NAME |
10000 |
The devicename which wasn't registered by a device manager was specified. |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
Driver can't be called (Failed in the device I/O control). |
CAN_ERR_DLL_CREATE_FILE |
10003 |
Failed in the creation of the file (Failed in CreateFile). |
CAN_ERR_INFO_INVALID_DEVICE |
10050 |
Specified device name is not found. Please check spelling. |
CAN_ERR_INFO_NOT_FIND_DEVICE |
10051 |
Not found the available device. |
The others (See also: Details of Error Code)
None
Retrieves the device ID, then the device
can be accessed.
By using this device ID, you can access the device in the following functions.
When accessing more than one device, please prepare corresponding variables
to store the IDs.
After CanInit completed normally, and before CanExit is called, every function
can be used.
Only one process can access one device.
Please be sure to connect
the device on your PC before you execute your application software.
Otherwise, There is possibility to occur the error
with CanInit() function.
Initializes the device "CAN000" and retrieves the Id.
VB.NET |
Dim Ret As Integer |
C, C++ |
long Ret; |
C# |
int Ret; |
Python |
Ret = ctypes.c_long() Id = ctypes.c_short() |