DioSetTrgCallBackProc


Function

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

Format

Ret = DioSetTrgCallBackProc ( 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 trigger 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 trigger notification set by the DioNotifyTrg function from the callback function. Therefore, it is necessary to set trigger condition using the DioNotifyTrg function first. In addition, use the DioStopNotifyTrg function to stop trigger monitor function.

Example

Registers the callback function for the DioNotifyTrg function.

VB.NET

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

C, C++

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

C#

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

Python

Ret = ctypes.c_long()
Ret.value = cdio.DioSetTrgCallBackProc ( 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)=Trigger 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 DioSetTrgCallBackProc function is passed.
It will be NULL when the Param parameter was specified to NULL.

Return Value

None