AioSetAiFilter


Function

Sets the filter for the analog input value.

Format

Ret = AioSetAiFilter ( Id ,  AiChannelNo , AiChannelNum , FilterType , FilterValueLow , FilterValueHigh , FilterUnit )

Parameters

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

AiChannelNo [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Sets the channel numbers into an array and specifies the base address of the array.

AiChannelNum [ C, C++: unsigned short ] [ Python: ctypes.c_ushort ]
Specifies the number of channels specified in AiChannelNo.

FilterType [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Sets the filter types into an array and specifies the base address of the array.

Filter type

Macro

Value [dec]

Filter disabled

AIO_PARAM_AI_FILTER_TYPE_DISABLE

0

Low-pass filter

AIO_PARAM_AI_FILTER_TYPE_LOW_PASS

1

FilterValueLow [ C, C++:unsigned long long *] [ Python: ctypes.POINTER(ctypes.c_ulonglong) ]
Sets the filter lower limit value into an array and specifies the base address of the array.

If filter type is "Filter disabled", this parameter is not used.
If filter type is "Low-pass filter", specify a value for this parameter.

FilterValueHigh [ C, C++:unsigned long long *] [ Python: ctypes.POINTER(ctypes.c_ulonglong) ]
Sets the filter upper limit value into an array and specifies the base address of the array.

If filter type is "Filter disabled", this parameter is not used.
If filter type is "Low-pass filter", this parameter is not used.

FilterUnit [ C, C++: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Sets the unit of filter value into an array and specifies the base address of the array.

The filter lower limit value and filter upper limit value have the same unit.
If filter type is "Filter disabled", this parameter is not used.

Unit of filter value

Macro

Value [dec]

MHz

AIO_PARAM_AI_FILTER_UNIT_MEGA_HZ

1

kHz

AIO_PARAM_AI_FILTER_UNIT_KIRO_HZ

2

Hz

AIO_PARAM_AI_FILTER_UNIT_HZ

3

mHz

AIO_PARAM_AI_FILTER_UNIT_MIRI_HZ

4

Return value

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

Return values

Content

0

Normality completion

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.

20001

This function can't be used by this device

22550

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

22551

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

22552

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

22553

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

22554

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

22555

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

Initial value

Filter disabled (FilterType = 0)

Remarks

Sets the filter for the analog input value.

Specifications based on devices

AI-80M1202-PE

The possible setting value are "Filter disabled" or "Low-pass filter 20MHz".

Example

Set "Low-pass filter" (AIO_PARAM_AI_FILTER_TYPE_LOW_PASS) and filter lower limit value = 20MHz for channel 0.

C, C++

long Ret;
unsigned short AiChannelNo[0];
unsiged short FilterType[0];
unsigned long long FilterValueLow[0];
unsigned long long FilterValueHigh[0];
unsigned short FilterUnit[0];

AiChannelNo[0] = 0;
FilterType[0] = AIO_PARAM_AI_FILTER_TYPE_LOW_PASS;
FilterValueLow[0] = 20;
FilterValueHigh[0] = 0;
FilterUnit[0] = AIO_PARAM_AI_FILTER_UNIT_MEGA_HZ;

Ret = AioSetAiFilter ( Id , &AiChannelNo[0] , 1 , &FilterType[0] , &FilterValueLow[0], &FilterValueHigh[0] , &FilterUnit[0] )
 

Python

Ret = ctypes.c_long()
AiChannelNoType = ctypes.c_ushort() * 1
AiChannelNo = AiChannelNoType()
FilterTypeType = ctypes.c_ushort() * 1
FilterType = FilterTypeType()
FilterValueLowType = ctypes.c_ulong() * 1
FilterValueLow = FilterValueLowType ()
FilterValueHighType = ctypes.c_ulong() * 1
FilterValueHigh = FilterValueHighType()
FilterUnitType = ctypes.c_ushort() * 1
FilterUnit = FilterUnitType()  

AiChannelNo[0] = 0
FilterType[0] = caio.AIO_PARAM_AI_FILTER_TYPE_LOW_PASS
FilterValueLow[0] = 20
FilterValueHigh[0] = 0
FilterUnit[0] = caio.AIO_PARAM_AI_FILTER_UNIT_MEGA_HZ

Ret.value = caio.AioSetAiFilter ( Id , AiChannelNo , 1 , FilterType , FilterValueLow, FilterValueHigh , FilterUnit  )
 

See also

AioGetAiFilter