CntSetInputHardwareEvent


Function

Sets the hardware event of the control input signal. Supports multi-processing.

Format

Ret = CntSetInputHardwareEvent ( Id , ChNo , EventType , RF0 , RF1 , Reserved )

Parameters

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

ChNo [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the channel number for setting

EventType [ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong ]
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 [ VB.NET: Short ] [ C, C++: short ] [ 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 [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify 0.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value

Description

CNT_ERR_SUCCESS

0

Normality completion

CNT_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute the function CntResetDevice to return from the standby mode.

CNT_ERR_DLL_INVALID_ID

10001

Invalid ID was specified.

CNT_ERR_DLL_CALL_DRIVER

10002

CNT driver can't be called (Failed in the device I/O control).

CNT_ERR_SYS_NOT_SUPPORTED

20001

This function can't be used by this device.

CNT_ERR_SYS_CH_NO

20201

Channel number is out of range.

CNT_ERR_SYS_EVENT_TYPE

20302

The kind of hardware event is out of range.

CNT_ERR_SYS_INPUT_LOGIC

20303

The coefficient of one-shot pulse width is out of range.

The others: (See also: Details of Error Code)

Remarks

Execute this function before the counter is started.

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

Sets counter start/stop of channel 0 as a hardware event.

VB.NET

Dim Ret As Integer
Ret = CntSetInputHardwareEvent ( Id , 0 , CNT_IEVENT_STARTSTOP , CNT_INP_FALL , CNT_INP_FALL , 0 )
 

C, C++

long Ret;
Ret = CntSetInputHardwareEvent ( Id , 0 , CNT_IEVENT_STARTSTOP , CNT_INP_FALL , CNT_INP_FALL , 0 );
 

C#

int Ret;
Ret = cnt.SetInputHardwareEvent ( Id , 0 , (uint)CcntConst.CNT_IEVENT_STARTSTOP , (short)CcntConst.CNT_INP_FALL , (short)CcntConst.CNT_INP_FALL , 0 );
 

Python

Ret = ctypes.c_long()
Ret.value = ccnt.CntSetInputHardwareEvent ( Id , 0 , ccnt.CNT_IEVENT_STARTSTOP , ccnt.CNT_INP_FALL , ccnt.CNT_INP_FALL , 0 )
 

See Also

CntSetOutputHardwareEvent CntInputDIByte CntSetPresetRegister