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.

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

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.

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.

Specifications based on devices

CPSN-MCB271 + CPSN-CNT-3201I2

Output logic of control output signal (OutputLogic)

Definition

Value

Description

CNT_OEVENT_NEGATIVE

0

Negative logic

CNT_OEVENT_POSITIVE

1

Positive logic

 

Control output signal hardware event type(EventType)

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_AIERR

08H

Abnormal Input Error

 

Pulse width for one-shot pulse (PulseWidth)

Value

Pulse width

0h

0usec

1h

Approx. 409.6usec

2h

Approx. 819.21usec

3h

Approx. 1.23msec

4h

Approx. 4.92msec

5h

Approx. 10.24msec

6h

Approx. 20.07msec

7h

Approx. 29.9msec

8h

Approx. 40.14msec

9h

Approx. 49.97msec

Ah

Approx. 60.2msec

Bh

Approx. 70.04msec

Ch

Approx. 80.28msec

Dh

Approx. 90.11msec

Eh

Approx. 100.35msec

Fh

Approx. 104.45msec

 

 

CNT-3204IN-ETH

CNT-3204IN-USB

CNT-3204MT-LPE

CNT32-4MT(LPCI)

Output logic of control output signal (OutputLogic)

Definition

Value

Description

CNT_OEVENT_NEGATIVE

0

Negative logic

CNT_OEVENT_POSITIVE

1

Positive logic

 

Control output signal hardware event type(EventType)

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

 

 

Pulse width for one-shot pulse (PulseWidth)

Value

Pulse width

0H

10us

1H

100us

2H

1ms

3H

10ms

4H

100ms

 

CNT-3208M-PE

CNT32-8M(PCI)

 

Output logic of control output signal (OutputLogic)

Set positive logic / negative logic with SW2 on the board. Specify 0 when executing this function.

 

Control output signal hardware event type(EventType)

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

 

 

Pulse width for one-shot pulse (PulseWidth)

Value

Pulse width

0H

10us

1H

100us

2H

1ms

3H

10ms

4H

100ms

 

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