AioSetCntComparisonMode


Function

Sets the counter operation as comparison count match occurs.

Format

Ret = AioSetCntComparisonMode ( Id , CntChannel , CntMode )

Parameters

Id [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the ID retrieved from AioInit.

CntChannel [ C, C++ : short ] [ Python : ctypes.c_short ]
Sets the channel of counter.

CntMode [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the operation mode from the following  range in macro or numerical value.
CntMode has the following meanings in bit, it can be specified by a combination of these bits.

Operation mode

Macro

Value

Preset count value load

CNT_LOADPRESET

00000001H

Comparison count value load

CNT_LOADCOMP

00000002H

Return values

Ret [ C, C++ : long ] [ Python : ctypes.c_long ]

Return values

Content

0

Normality completion

7

Execute AioResetDevice function because the device has recovered from standby mode

10001

Invalid Id was specified
Use the Id retrieved from AioInit to specify the Id in this function.

10002

AIO driver can't be called
At first, perform AioInit function.

15000

The value of CntChannel is outside the designated range of the function

20001

This function can't be used by this device

20002

Can not use while by another device works
To use this function, counter operation must be stopped.

20003

Can not use because another process is using the device
When another process is using the device, all functions except for those that support multi-process can not be performed.

25000

The value of CntChannel is outside the designated range of the device being used

25002

Operation mode 'preset count value load' is not enable

25003

Operation mode 'Comparison count value load' is not enable

Initial values

CntMode = 0
In this case, "Preset count value load" and "Comparison count value load" are always fixed to 0.

Remarks

The function sets the counter operation after the comparison count match.

If "Preset count value load" is set as operation mode, the count value will move to the preset value set in advance after comparison count match.
If the value is set, you must set the preset value using the function AioSetCntPresetReg. 
If the preset value isn't set, it becomes the initial value 0.

If "Comparison count value load" is set as operation mode, the next comparison count value after comparison count match will be updated to the value that is set by AioSetCntComparisonReg. 
If the value is set, you must set the comparison count value using the function AioSetCntComparisonReg.
If the comparison count value isn't set,  it becomes the initial value 0.

This function cannot be used on devices without counter functionality.
If the device is in operation, the function cannot be performed.

In the case of Analog L Series
- Even if CNT_LOADPRESET is specified, it's not valid.
- When the comparison count match has occurred, the count value is cleared to zero.

Specifications based on devices

AI-1664UG-PE
AIO-163202G-PE
AIO-163202UG-PE
AIO-123202G-PE
AIO-123202UG-PE
AIO-163202F-PE
ADA16-32/2(PCI)F

All operation mode can be used.

AIO-160802L-LPE
ADA16-8/2(LPCI)L
ADAI16-8/2(LPCI)L
AIO-160802LI-PE

All operation mode can be used.

AI-1616L-LPE
AD16-64(LPCI)LA
AD16-16(LPCI)L
ADI16-16(LPCI)L
AI-1616LI-PE
AI-1664LA-LPE

All operation mode can be used.

AO-1604L-LPE
DA16-16(LPCI)L
DA16-8(LPCI)L
DA16-4(LPCI)L
DAI16-4(LPCI)L
AO-1604LI-PE
AO-1608L-LPE
AO-1616L-LPE

All operation mode can be used.

AIO-163202FX-USB

All operation mode can be used.

AIO-121602LN-USB
AIO-120802LN-USB

All operation mode can be used.

AI-1664LAX-USB

All operation mode can be used.

AO-1604LX-USB

All operation mode can be used.

Example

Sets "Preset count value load" as the operation mode for channel 0.

C, C++

long Ret;
Ret = AioSetCntComparisonMode ( Id , 0 , CNT_LOADPRESET );
 

Python

Ret = ctypes.c_long()
Ret.value = caio.AioSetCntComparisonMode ( Id , 0 , caio.CNT_LOADPRESET )
 

See also

AioGetCntComparisonMode, AioSetCntPresetReg, AioSetCntComparisonReg