CntInit


Function

Retrieves the device ID, then the device could be accessed

Format

Ret = CntInit ( DeviceName , Id )

Parameters

DeviceName [ C: char * ] [ Python: ctypes.c_char_p ]
Specifies the device name set with the setup tool(config). Device name is maximum 50 characters(NULL is included).

Id [ C: short * ] [ Python: ctypes.POINTER(ctypes.c_short) ]
Returns the device ID. By using this device ID, you can access the device in the following functions.

Return Value

Ret [ C: long ] [ Python: ctypes.c_long ]

Definition

Value

Description

CNT_ERR_SUCCESS

0

Normal Complete

CNT_ERR_INI_MEMORY

3

Failed in memory.

CNT_ERR_INI_REGISTRY

4

Failed in accessing the setting file.

CNT_ERR_INI_BOARD_ID

5

Board ID is duplicated.

CNT_ERR_DLL_DEVICE_NAME

10000

Device name which isn't registered in setting file is specified.

CNT_ERR_DLL_CALL_DRIVER

10002

Driver cannot be called (failed in ioctl).

CNT_ERR_DLL_CREATE_FILE

10003

Failed in creating file (open failed).

CNT_ERR_INFO_INVALID_DEVICE

10050

Specified device name isn't found. Please check the spelling.

CNT_ERR_INFO_NOT_FIND_DEVICE

10051

The usable device isn't found.

The other errors: (See also: Details of Error Code)

Initial Value

None

Remarks

Retrieves the device ID then the device can be accessed. By using this device ID, you can access the device in the following functions. If you want to access more than one device, you need to provide several variables to store IDs. After CntInit normal completed, each function can be used until CntExit is called.

Example

Initializes the device "CNT000" and retrieves the Id.

C

Ret = CntInit("CNT000", &Id);
 

Python

Ret = ccnt.CntInit("CNT000", ctypes.byref(Id))
 

See Also

CntExit