CntSetCountDirection


Function

Sets the counting direction. (Up count/Down count)

Format

Ret = CntSetCountDirection ( Id , ChNo , Dir )

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.

Dir [ C, C++ : short] [Python: ctypes.c_short]
Specifies the counting direction. Select the counting direction from the following defined values.

Definition

Value

Description

CNT_DIR_DOWN

0

Down count

CNT_DIR_UP

1

Up count

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.

The other errors: (See also: Details of Error Code)

Initial Value

Up count (1)

CPSN-CNT-3201I2

When used in combination with CPSN-MCB271, the initial value immediately after power-on depend on the settings configured via the web browser.

Remarks

Specifies the counting direction for the specified channel.
The setting in this function is effective after the counter starts.

Example

C, C++

Ret = CntSetCountDirection ( Id , ChNo , Dir );
 

Python

Ret = ccnt.CntSetCountDirection ( Id , ChNo , Dir )
 

See Also

CntGetCountDirection