DioSetInterruptCallBackProc


Function

Registers the callback function, it will be called when the event occurred by the trigger monitor setting with the DioNotifyInterrupt function.

Format

Ret = DioSetInterruptCallBackProc (  Id , CallBackProc , Param )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from DioInit.

CallBackProc [ VB.NET: IntPtr ] [ C, C++: long * ] [ C#: IntPtr ] [ Python: ctypes.POINTER(ctypes.c_long) ]
Specify the address of the callback function.

Param [ VB.NET: IntPtr ] [ C, C++: void * ] [ C#: void * ] [ Python: ctypes.c_void_p ]
Specify the address of the parameter that is passed to the callback function. Specify it to NULL when the parameter is unnecessary.

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_SYS_RECOVERED_FROM_STANDBY

7

Execute DioResetDevice function because the device has recovered from standby mode.

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

DIO_ERR_DLL_CALL_DRIVER

10002

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

DIO_ERR_DLL_BUFF_ADDRESS

10100

Invalid data buffer address.

DIO_ERR_SYS_NOT_SUPPORTED

20001

This board couldn't use this function.

The others (See also: Details of Error Code)

Remarks

Use this function to register the callback function, then the callback function will be called when the interrupt event occurred. Though the operation of the callback function is similar to an event, it is different from an event that the window handle is not necessary for it, so the application without a window also can use it.

This function is used to perform the interrupt notification set by the DioNotifyInterrupt function from the callback function. Therefore, it is necessary to set interrupt notification condition using the DioNotifyInterrupt function first.

Example

Registers the callback function for the DioNotifyInterrupt function.

VB.NET

Please refer to [Note of Using Visual Basic .NET].
 

C, C++

long Ret;
Ret = DioSetInterruptCallBackProc ( Id , CallBackProc , this );
 

C#

Please refer to [Note of Using Visual C#].
 

Python

Ret = ctypes.c_long()
Ret.value = cdio.DioSetInterruptCallBackProc ( Id , CallBackProc , 0 )
 


Callback Function

Format

void CallBackProc ( Id , wParam , lParam , Param )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Pass the ID retrieved from DioInit.

wParam [ VB.NET: Integer ] [ C, C++: WPARAM ] [ C#: int ] [ Python: ctypes.wintypes.WPARAM ]
This parameter is passed from the driver. It is not used now.

lParam [ VB.NET: Integer ] [ C, C++: LPARAM ] [ C#: int ] [ Python: ctypes.wintypes.LPARAM ]
LOWORD(lParam)=Interrupt bit number
HIWORD(lParam)=Rising edge: 1, Falling edge: 2
* HIWORD indicates the high-order word. LOWORD indicates the low-order word.

Param [ VB.NET: IntPtr ] [ C, C++: void * ] [ C#: void * ] [ Python: ctypes.c_void_p ]
The parameter specified by the DioSetInterruptCallBackProc function is passed.
It will be NULL when the Param parameter was specified to NULL.

Return Value

None