AioGetAiSamplingDataEx


Function

Reads the sampling data of specified times from the device memory (software memory). The converted data are stored in Voltage or Current.
This function can only be used when the transfer mode of the conversion data that is set by AioSetAiTransferMode is Device buffer mode.
It cannot be used when the transfer mode of the conversion data is User buffer mode.

Format

Ret = AioGetAiSamplingDataEx ( Id , AiSamplingTimes , AiData )

Parameters

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

AiSamplingTimes [ VB.NET : Integer ] [ C, C++ : long * ] [ C# : ref int ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the address of variable which has stored the sampling times of acquiring data.
After this function is executed, return the actual number of samplings which has been read.

AiData [ VB.NET : Single() ] [ C, C++ : float * ] [ C# : ref float[] ] [ Python : ctypes.POINTER(ctypes.c_float) ]
Specifies the address of array which stores the converted data. The converted data are stored in Voltage or Current.

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.

11880

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

11881

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

20001

This function can't be used by this device

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.

21880

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

21881

It tried to acquire data beyond the converted number
 AiSamplingTimes is changed to the maximum value

21885

FIFO is empty

21886

It tried to acquire data beyond the memory size. AiSamplingTimes is changed to the maximum value

Remarks

In AioStartAi, the used data are stored by each channel.
This function cannot be used on devices without the analog input function.

In FIFO memory
Usually the old data is read in.
The data that has ever been read cannot be reread. 
It can be used if the device is in operation.

In RING memory
Retrieves the data of the specified sampling number from the latest data.
The same data can be repeated retrieved.
It can't be used if the device is in operation.

Example

Reads the sampling data of 1000 times.

VB.NET

Dim Ret As Integer
Dim AiSamplingTimes As Integer
Dim AiData(1000) As Single
AiSamplingTimes = 1000
Ret = AioGetAiSamplingDataEx ( Id , AiSamplingTimes , AiData )
 

C, C++

long Ret;
long AiSamplingTimes;
float AiData[1000];
AiSamplingTimes = 1000;
Ret = AioGetAiSamplingDataEx ( Id , &AiSamplingTimes , &AiData[0] );
 

C#

int Ret;
int AiSamplingTimes;
float[] AiData = new float[1000];
AiSamplingTimes = 1000;
Ret = aio.GetAiSamplingDataEx ( Id , ref AiSamplingTimes , ref AiData );
 

Python

Ret = ctypes.c_long()
AiSamplingTimes = ctypes.c_long()
AiDataType = ctypes.c_float * 1000
AiData = AiDataType()
AiSamplingTimes.value = 1000
Ret.value = caio.AioGetAiSamplingDataEx ( Id , &AiSamplingTimes , &AiData[0] )
 

See also

AioGetAiSamplingData