CntSetOutputHardwareEvent


Function

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

Format

Ret = CntSetOutputHardwareEvent ( Id , ChNo , OutputLogic , EventType , PulseWidth )

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.

OutputLogic [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the output logic of control output signal.

Definition

Value

Description

CNT_OEVENT_NEGATIVE

0

Negative logic

CNT_OEVENT_POSITIVE

1

Positive logic

* For CNT32-8M (PCI) and CNT-3208M-PE, set positive logic / negative logic with SW2 on the board.
   Specify 0 when executing this function.

EventType [ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong ]
Specifies the control output signal hardware event type. When the specified conditions are satisfied, a pulse is output on the control output signal line. The control output signal hardware event is set by the logical sum of the following value.
For general-purpose output, the other conditions cannot be specified at the same time. And, it is not possible to specify "Disconnection Alarm Error" with the device that cannot select "Differential" as an external signal source.

Definition

Value

Description

CNT_OEVENT_GENOUT

00H

General-purpose output

CNT_OEVENT_MATCH0

01H

Count Match Register0

CNT_OEVENT_MATCH1

02H

Count Match Register1

CNT_OEVENT_FLTERR

04H

Filter Error

CNT_OEVENT_AIERR

08H

Abnormal Input Error

CNT_OEVENT_ALMERR

10H

Disconnection Alarm Error

PulseWidth [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify pulse width coefficient for one-shot pulse. When general-purpose output is used, the pulse width is invalid. Specify 0.

Value

Pulse width

0H

10us

1H

100us

2H

1ms

3H

10ms

4H

100ms

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_DLL_MODE

10100

Invalid mode setting.

CNT_ERR_SYS_NOT_SUPPORTED

20001

This function can't be used by this device.

CNT_ERR_SYS_MODE

20100

Invalid mode setting.

CNT_ERR_SYS_CH_NO

20201

Channel number is out of range.

CNT_ERR_SYS_OUTPUT_LOGIC

20301

The output logic of the control output signal is out of range.

CNT_ERR_SYS_EVENT_TYPE

20302

The kind of hardware event is out of range.

CNT_ERR_SYS_PULSE_WIDTH

20303

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

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

Remarks

This function should be executed before starting the counter.

Example

Sets the hardware event to Count Match Register0 for channel 0.

VB.NET

Dim Ret As Integer
Ret = CntSetOutputHardwareEvent ( Id , 0 , CNT_OEVENT_NEGATIVE , CNT_OEVENT_MATCH0 , 0 )
 

C, C++

long Ret;
Ret = CntSetOutputHardwareEvent ( Id , 0 , CNT_OEVENT_NEGATIVE , CNT_OEVENT_MATCH0 , 0 );
 

C#

int Ret;
Ret = cnt.SetOutputHardwareEvent ( Id , 0 , (short)CcntConst.CNT_OEVENT_NEGATIVE , (uint)CcntConst.CNT_OEVENT_MATCH0 , 0 );
 

Python

Ret = ctypes.c_long()
Ret.value = ccnt.CntSetOutputHardwareEvent ( Id , 0 , ccnt.CNT_OEVENT_NEGATIVE , ccnt.CNT_OEVENT_MATCH0 , 0 )
 

See Also

CntSetInputHardwareEvent