CntSetCountMatchHardwareEvent


Function

Sets the hardware event of count match. Supports multi-processing.

Format

Ret = CntSetCountMatchHardwareEvent ( Id , ChNo , RegisterNo , EventType , 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.

RegisterNo [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the number of the comparison register.
Allowable range:
0 <= RegisterNo <= 1

EventType [ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong ]
Specify the kind of the hardware event of the count match.
The set operation is performed when count matched.
Set the hardware event of count match from the following table.

Definition

Value

Description

CNT_MATCH_NONE

0

Event specification invalidity

CNT_MATCH_PRESET

1

Count value preset

CNT_MATCH_CLEAR

2

Count value zero clear

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_REGNO

20204

Compare register number is out of range.

CNT_ERR_SYS_EVENT_TYPE

20302

The kind of hardware event is out of range.

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

Remarks

Perform this function before the counter starts.

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 "Count value 0 clearing" for the count match of channel 0.

VB.NET

Dim Ret As Integer
Ret = CntSetCountMatchHardwareEvent ( Id , 0 , 0 , CNT_MATCH_CLEAR , 0 )
 

C, C++

long Ret;
Ret = CntSetCountMatchHardwareEvent ( Id , 0 , 0 , CNT_MATCH_CLEAR , 0 );
 

C#

int Ret;
Ret = cnt.SetCountMatchHardwareEvent ( Id , 0 , 0 , (short)CcntConst.CNT_MATCH_CLEAR , 0 );
 

Python

Ret = ctypes.c_long()
Ret.value = ccnt.CntSetCountMatchHardwareEvent ( Id , 0 , 0 , ccnt.CNT_MATCH_CLEAR , 0 )
 

See Also

CntSetPresetRegister