Function
Sets the hardware event of control output signal. Supports multi-processing.
Format
Ret = CntSetOutputHardwareEvent ( Id , ChNo , OutputLogic , EventType , PulseWidth )
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.
OutputLogic
[ C, 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 CNT-3208M-PE or CNT32-8M(PCI), set positive logic / negative logic
with SW2 on the board.
Specify 0 when executing this function.
EventType
[ C, C++ : int] [Python: ctypes.c_int]
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
[ C, 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.
For "Device with usual counter", please use CntSetPulseWidth.
Value |
Pulse width |
0H |
10us |
1H |
100us |
2H |
1ms |
3H |
10ms |
4H |
100ms |
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_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 other errors: (See also: Details of Error Code)
Remarks
This function should be executed before starting the counter.
Example
C, C++ |
Ret = CntSetOutputHardwareEvent
(Id, 0, CNT_OEVENT_NEGATIVE, CNT_OEVENT_MATCH0, 0); |
Python |
Ret = ccnt.CntSetOutputHardwareEvent
(Id, 0, ccnt.CNT_OEVENT_NEGATIVE, ccnt.CNT_OEVENT_MATCH0, 0) |
See Also