DioSetTrgEvent


Function

Sets the factor of trigger event.

Format

Ret = DioSetTrgEvent ( Id , BitNo , Logic , Tim )

Parameters

Id [C:short] [Python: ctypes.c_short]
Specifies the device ID retrieved from DioInit.

BitNo [C:short] [Python: ctypes.c_short]
Specified the bit number of input logic.

Logic [C:short] [Python: ctypes.c_short]
Specify the trigger logic by the logical OR of the following defined value.

Definition

Value

[Dec]

Description

DIO_TRG_NONE

0

Mask trigger

DIO_TRG_RISE

1

Input Value 0->1

DIO_TRG_FALL

2

Input Value 1->0

Tim [C:long] [Python: ctypes.c_long]
Specify the period for monitoring trigger in ms(milisecond).
Available range: 10ms ~ 2147483647ms

Return Value

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

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal complete

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID is specified.

DIO_ERR_DLL_CALL_DRIVER

10002

Driver cannot be called (failed in ioctl).

DIO_ERR_DLL_TRG_KIND

10300

Trigger type is outside of the specified range.

DIO_ERR_SYS_NOT_SUPPORTED

20001

This function cannot be used for this device.

DIO_ERR_SYS_BOARD_EXECUTING

20002

It cannot perform because the device is executing.

DIO_ERR_SYS_TIM

20300

Timer value is outside of the specified range.

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

Remarks

When starting or stopping trigger event, use this function to specify.
The function of monitoring trigger is a function that monitor the change of the specified bit's input value by using the system timer.
When the input value of the bit changes from 0 to 1 or from 1 to 0, the call back notifies the application the change of bit.
Specifies the call back function by DioSetTrgCallBackProc.
When triggers occur at same time, it is in-order notified from the low order bit.
This function cannot be used for DIO-CPS-BXC200.

For Ethernet devices
    If communication with the device is lost, the process will be unregistered and will no longer receive event notifications.
    If you want to perform event notification again, please make the settings again using this function.

     You can check the registration status of the current process using the DioGetNetCommunicationInfo function.

Example

C

Ret = DioSetTrgEvent( Id , BitNo , DIO_TRG_RISE | DIO_TRG_RISE, Tim );
 

Python

Ret = cdio.DioSetTrgEvent( Id , BitNo , cdio.DIO_TRG_RISE | cdio.DIO_TRG_RISE, Tim )
 

See Also

DioSetTrgEvent
DioSetTrgCallBackProc
Trigger_Function
DioGetNetCommunicationInfo