Function
Sets the hardware event of the control input signal. Supports multi-processing.
Format
Ret = CntSetInputHardwareEvent ( Id , ChNo , EventType , RF0 , RF1 , Reserved )
Parameters
Id
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the device ID retrieved from CntInit.
ChNo
[ C, C++ : short] [Python: ctypes.c_short]
Specifies the channel number which you want to set.
EventType
[ C, C++ : int] [Python: ctypes.c_int]
Specify the kind of hardware event of control input signal. The set operation
is executed, when the specified condition is satisfied. The hardware event
of the control input signal is set in from the following values.
Definition |
Value |
Description |
CNT_IEVENT_GENINP |
0 |
General-purpose input |
CNT_IEVENT_STARTSTOP |
1 |
Counter start/stop |
CNT_IEVENT_PRESET |
2 |
Count value preset |
CNT_IEVENT_CLEAR |
3 |
Count value zero clear |
RF0,RF1
[ C, C++ : short] [Python: ctypes.c_short]
Sthat the specified event is performed on whether the rising or falling
of the control input signal. For presetting count value or 0-clearing
count value, set the condition with RF0. For counter start/stop, set the
condition for start with RF0, set the condition for stop with RF1.
Definition |
Value |
Description |
CNT_INP_NONE |
0 |
Not executed |
CNT_INP_RIZE |
1 |
Executing by rising |
CNT_INP_FALL |
2 |
Executing by falling |
Reserved
[ C, C++ : short] [Python: ctypes.c_short]
Specify 0.
Return Value
Ret [ C, C++ : long] [Python: ctypes.c_long]
Definition |
Value |
Description |
CNT_ERR_SUCCESS |
0 |
Normal Complete |
CNT_ERR_DLL_INVALID_ID |
10001 |
Invalid ID is specified. |
CNT_ERR_DLL_CALL_DRIVER |
10002 |
Driver cannot be called (failed in ioctl). |
CNT_ERR_DLL_MODE |
10100 |
Invalid mode setting. |
CNT_ERR_SYS_MODE |
20100 |
Invalid mode setting. |
CNT_ERR_SYS_CH_NO |
20201 |
Channel number is outside the range. |
CNT_ERR_SYS_EVENT_TYPE |
20302 |
The kind of hardware event is out of range. |
CNT_ERR_SYS_INPUT_LOGIC |
20304 |
The coefficient of one-shot pulse width is out of range. |
The other errors: (See also: Details of Error Code)
Remarks
This function should be executed before starting the counter.
The case of set Count value preset(CNT_IEVENT_PRSET)
on EventType arrgument,
it will be loaded Preset value set by CntSetPresetRegister
function at the moment the hardware event's condition is met.
Example
C, C++ |
Ret = CntSetInputHardwareEvent
(Id, 0, CNT_IEVENT_STARTSTOP, CNT_INP_FALL, CNT_INP_FALL, 0); |
Python |
Ret = ccnt.CntSetInputHardwareEvent
(Id, 0, ccnt.CNT_IEVENT_STARTSTOP, ccnt.CNT_INP_FALL, ccnt.CNT_INP_FALL,
0) |
See Also
CntSetOutputHardwareEvent CntInputDIByte CntSetPresetRegister