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 |
10002 |
AIO
driver can't be called |
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 |
20003 |
Can
not use because another process is using the device |
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 |
All operation mode can be used. |
AIO-160802L-LPE |
All operation mode can be used. |
AI-1616L-LPE |
All operation mode can be used. |
AO-1604L-LPE |
All operation mode can be used. |
AIO-163202FX-USB |
All operation mode can be used. |
AIO-121602LN-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; |
Python |
Ret
= ctypes.c_long() |
See also
AioGetCntComparisonMode, AioSetCntPresetReg, AioSetCntComparisonReg