DioInit


Function

Retrieves the device ID then the device can be accessed.

Format

Ret = DioInit ( 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.c_short]
Returns the device ID. By using this device ID, you can access to the device in the following functions.

Return Value

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

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal complete

DIO_ERR_INI_MEMORY

3

Failed in memory allocation.

DIO_ERR_INI_REGISTRY

4

Failed in accessing the setting file.

DIO_ERR_INI_BOARD_ID

5

Board ID is duplicated.

DIO_ERR_DLL_DEVICE_NAME

10000

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

DIO_ERR_DLL_CALL_DRIVER

10002

Driver cannot be called (failed in ioctl).

DIO_ERR_DLL_CREATE_FILE

10003

Failed in creating file (open failed).

DIO_ERR_INFO_INVALID_DEVICE

10050

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

DIO_ERR_INFO_NOT_FIND_DEVIC

10051

The usable device isn't found.

The other errors:(See also: Error code details)

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 ID. After DioInit normal completed, each function can be used until DioExit is called.

Restrictions

The number of processes to access a board is 16 at most. But for the board supporting BusMaster, there is only 1 process to access it. There is no restriction on accessing from several threads in the same process.

Example

Initial a device "DIO000" , Id is retrieved.

C
 

Ret = DioInit( "DIO000", &Id );
 

Python

Ret = cdio.DioInit ( "DIO000" , ctypes.byref(Id) )
 

See Also

DioExit