DioInit


Function

Retrieves the device ID, then the device can be accessed.

Format

Ret = DioInit ( DeviceName , Id )

Parameters

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.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal completed.

DIO_ERR_INI_MEMORY

3

Invalid memory allocated.

DIO_ERR_INI_REGISTRY

4

Invalid registry access.

DIO_ERR_INI_NOT_FOUND_SYS_FILE

8

Because the Cdio.sys file is not found, it is not possible to initialize it.

DIO_ERR_INI_DLL_FILE_VERSION

9

Because version information on the Cdio.dll file cannot be acquired, it is not possible to initialize it.

DIO_ERR_INI_SYS_FILE_VERSION

10

Because version information on the Cdio.sys file cannot be acquired, it is not possible to initialize it.

DIO_ERR_INI_NO_MATCH_DRV_VERSION

11

Because version information on Cdio.dll and Cdio.sys is different, it is not possible to initialize it.

DIO_ERR_DLL_DEVICE_NAME

10000

Invalid device name specified.

DIO_ERR_DLL_CALL_DRIVER

10002

Not call the driver (Failure on DEVICE I/O CONTROL).

DIO_ERR_DLL_CREATE_FILE

10003

Not create the file (Failure on CreateFile).

DIO_ERR_INFO_INVALID_DEVICE

10050

Invalid device information specified. Please check the spell.

DIO_ERR_INFO_NOT_FIND_DEVIC

10051

Not find the available device.

The others (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.
When accessing more than one device, please prepare corresponding variables to store the IDs.
After DioInit completed normally, and before DioExit is called, every function can be used.

One device other than USB device can be accessed by up to 16 processes. For the BusMaster board, a device can be accessed only by one process.
There is no limit on the number of processes for USB devices, but only one process can use events.

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 DioInit() function.

Example

Initializes the device "DIO000" and retrieves the Id.

VB.NET

Dim Ret As Integer
Dim Id As Short
Ret = DioInit ( "DIO000" , Id )
 

C, C++

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

C#
 

int Ret;
short Id;
Ret = dio.Init ( "DIO000" , out Id );
 

Python

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

See Also

DioExit