Starts monitoring the trigger of the specified logical bit.
Ret = DioNotifyTrg ( Id , TrgBit , TrgKind , Tim , hWnd )
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the device ID retrieved from DioInit.
TrgBit [
VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the logical input bit which is monitored the trigger. The maximum
number of bits for monitoring the trigger is 255.
TrgKind
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the rising edge, falling edge or logical sum of both sides for
the monitoring content of a specified bit. The following definition values
are valid.
Definition |
Value [Dec] |
Description |
DIO_TRG_RISE |
1 |
Rising edge |
DIO_TRG_FALL |
2 |
Falling edge |
Tim [
VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long
]
Specify the period of trigger monitor in the unit of "msec".
The period of trigger monitor is set for each device separately.
The settable range for DI-XX(USB) and DIO-XX/XX(USB) is 1 msec to 2147483647
msec.
For other devices is 10 msec to 2147483647 msec.
hWnd [
VB.NET: IntPtr ] [ C, C++: HWND ] [ C#: IntPtr ] [ Python: ctypes.wintypes.HANDLE
]
Specifies the window handle to receive the trigger message.
The window handle can be retrieved by m_hWnd in VC.
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_CREATE_THREAD |
10005 |
Not create the thread (Failure on CreateThread). |
DIO_ERR_DLL_HWND |
10200 |
Window handle beyond the limit. |
DIO_ERR_DLL_TRG_KIND |
10300 |
Trigger kind beyond the limit. |
DIO_ERR_SYS_NOT_SUPPORTED |
20001 |
This board couldn't use this function. |
DIO_ERR_SYS_USING_OTHER_PROCESS |
20003 |
Other process is using the device, not execute. |
DIO_ERR_SYS_BIT_NO |
20102 |
Bit No. beyond the limit. |
DIO_ERR_SYS_TIM |
20300 |
Timer value beyond the limit. |
The others (See also: Details of Error Code)
The trigger monitor function is invalid.
The trigger monitor function is a function, that uses the device's own timer or the Windows's timer to monitor the change of the specified bit's input value. When the input value of a bit changes from 0 to 1 or from 1 to 0, the change of the bit will be notified to the application through the Window message.
For USB device, it is only one process that
can receives the trigger message.
The message cannot be sent from the same device to two or more processes.
The message ID is defined with DIOM_TRIGGER = 1340H. When the trigger occurs, the DIOM_TRIGGER message is posted to the specified window handle through the PostMessage function. The parameters of the message are wParam and lParam containing the following information respectively.
LOWORD(wParam)=ID retrieved from DioInit
LOWORD(lParam)=Trigger bit number
HIWORD(lParam)=Rising edge: 1, Falling edge, :2, Both sides: 3
* HIWORD indicates the high-order word. LOWORD indicates the low-order
word. For details about message handling, please refer to the sample programs
of each language.
To monitor the trigger for more than one
bit, call this function for each corresponding bit.
When this function is called for each bit, monitoring is performed at the
minimum value among the periods of trigger monitor set for devices.
This function cannot be used with 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.
The rising edge of logical bit 0 is monitored at 1000msec interval.
VB.NET |
Dim
Ret As Integer |
C, C++ |
long
Ret; |
C# |
int
Ret; |
Python |
Ret
= ctypes.c_long() |
DioStopNotifyTrg DioGetNetCommunicationInfo