AioSetCntPresetReg


Function

Sets the preset value loaded after the comparison count match.

Format

Ret = AioSetCntPresetReg ( Id , CntChannel , PresetNumber , PresetData , Flag )

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.

PresetNumber [ C, C++ : long ] [ Python : ctypes.c_long ]
Specifies the total number of the preset data to be set.

PresetData [ C, C++ : long * ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the pointer to the array that stores the preset of counter (initial value).
The range that can be set is different according to devices.

Flag [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies whether to repeatedly set the data array of preset data.

0

Not repeat

1

Repeat

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

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.

15020

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

15021

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

15022

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

15023

Pointer to PresetData 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.

25020

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

25021

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

Initial values

None

Remarks

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

If the preset data after comparison count match is fixed, please set PresetNumber = 1 and Flag = 1.

In order to use this functionality, you should set "Preset 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

PresetNumber can be set in 1 to 255(FFH).
PresetData can be set in 0 to 4294967295(FFFFFFFFH).

AIO-160802L-LPE
ADA16-8/2(LPCI)L
ADAI16-8/2(LPCI)L
AD16-64(LPCI)LA
AIO-160802LI-PE
AI-1616L-LPE
AD16-16(LPCI)L
ADI16-16(LPCI)L
DA16-16(LPCI)L
DA16-8(LPCI)L
AO-1604L-LPE
DA16-4(LPCI)L
DAI16-4(LPCI)L
AI-1616LI-PE
AI-1664LA-LPE
AO-1604LI-PE
AO-1608L-LPE
AO-1616L-LPE

PresetNumber can be set in 1 only.
PresetData can be set in 0 only.

AIO-163202FX-USB

PresetNumber can be set in 1 to 255(FFH).
PresetData can be set in 0 to 4294967295(FFFFFFFFH).

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

PresetNumber can be set in 1 to 255(FFH).
PresetData can be set in 0 to 4294967295(FFFFFFFFH).

AI-1664LAX-USB

PresetNumber can be set in 1 to 255(FFH).
PresetData can be set in 0 to 4294967295(FFFFFFFFH).

AO-1604LX-USB

PresetNumber can be set in 1 to 255(FFH).
PresetData can be set in 0 to 4294967295(FFFFFFFFH).

Example

Set the first preset data 10000 to channel 0 repeatedly.

C, C++

long Ret;
long PresetData;
PresetData = 10000;
Ret = AioSetCntPresetReg ( Id , 0 , 1 , &PresetData , 1 );
 

Python

Ret = ctypes.c_long()
PresetData = ctypes.c_long()
PresetData.value = 10000
Ret.value = caio.AioSetCntPresetReg ( Id , 0 , 1 , ctypes.byref(PresetData) , 1 )
 

See also

AioSetCntComparisonMode