AioSetCntComparisonReg


Function

Sets the next comparison count value loaded after comparison count match.

Format

Ret = AioSetCntComparisonReg ( Id , CntChannel , ComparisonNumber, ComparisonData, Flag )

Parameters

Id [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies the device ID retrieved from AioInit.

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

ComparisonNumber [ VB.NET : Integer ] [ C, C++ : long ] [ C# : int ] [ Python : ctypes.c_long ]
Specifies the total number of comparison count data to be set.

ComparisonData [ VB.NET : Integer() ] [ C, C++ : long * ] [ C# : int[] ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the pointer to the array that stores the comparison count.
The range that can be set is different according to devices.

Flag [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies whether to repeatedly set the data array of comparison count value.

0

Not repeat

1

Repeat

If Repeat is set, the first comparison count value data of the array is set again when the last comparison count value of the array matches the next comparison count set.
If Not repeat is set, data isn't preset when the last comparison count value of the array matches the followed comparison count set.

Return value

Ret [ VB.NET : Integer ] [ C, C++ : long ] [ C# : int ] [ 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.

15040

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

15041

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

15042

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

15043

Pointer to ComparisonData is NULL
Specify the address of variable to parameter.

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.

25040

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

25041

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

Initial value

None

Remarks

The value set by using this function is loaded as the next comparison count value after comparison count match.
The values set in the array are set in turn when comparison count match occurs every time.

If the comparison count value is fixed, please set ComparisonNumber = 1 and Flag = 1.

In order to use this functionality, you should set comparison count value load as the operation mode by using the function AioSetCntComparisonMode.
This function cannot be used on devices without counter functionality.
If the device is in operation, the function cannot be performed.

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

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

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

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

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

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

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

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

AIO-163202FX-USB

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

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

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

AI-1664LAX-USB

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

AO-1604LX-USB

ComparisonNumber can be set in 1 to 255(FFH).
ComparisonData can be set in 0 to 4294967295(FFFFFFFFH).

Example

Set the first comparison count value 10000 to channel 0 repeatedly.

VB.NET

Dim Ret As Integer
Dim ComparisonData(0) As Integer
ComparisonData(0) = 10000
Ret = AioSetCntComparisonReg ( Id , 0 , 1 , ComparisonData , 1 )
 

C, C++

long Ret;
long ComparisonData;
ComparisonData = 10000;
Ret = AioSetCntComparisonReg ( Id , 0 , 1 , &ComparisonData , 1 );
 

C#

int Ret;
int[] ComparisonData = new int[1];
ComparisonData[0] = 10000;
Ret = aio.SetCntComparisonReg ( Id , 0 , 1 , ComparisonData , 1 );
 

Python

Ret = ctypes.c_long()
ComparisonData = ctypes.c_long()
ComparisonData.value = 10000
Ret.value = caio.AioSetCntComparisonReg ( Id , 0 , 1 , ctypes.byref(ComparisonData) , 1 )
 

See also

AioSetCntComparisonMode