AioGetAiTransferCount


Function

Retrieves the number of data that are transferred from the user memory.
This function can only be used when the transfer mode of the conversion data that is set by AioSetAiTransferMode is User buffer mode.
It cannot be used when the transfer mode of the conversion data is Device buffer mode.

Format

Ret = AioGetAiTransferCount ( ID , AiTransferCount )

Parameters

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

AiTransferCount [ C, C++ : long * ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the address of the variable that stores the transfer count.

Return value

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.

12140

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

Initial value

In all devices, AiTransferCount = 0

Remarks

As conversion is started by AioStartAi, AiTransferCount is reset to 0 automatically.

It's not the number of all the transferred count, it's the transferred position in the user buffer.
If using User buffer mode, as function AioStartAi/AioStartAiSync is performed, the conversion data will be stored from the beginning of the buffer.

0 is returned to the transfer count at the gap of memory.
The total transfer count can be confirmed by using this function along with function AioGetAiTransferLap.
If [Not overwrite the memory] is set by function AioSetAiMemoryType,
it can be avoided that 0 is returned to the transfer count,
by using function AioSetAiTransferData to allocate a buffer which is larger than the expect transfer count.
This function can be executed if the device is in operation.
This function cannot be used on devices without the analog input function.

In the case of Z-series devices such as AI-1204Z-PE, data is transferred to the PC side every 128-512 samplings for optimization.
Therefore, there is such a possibility that the count doesn't work when the clocks input, but the sampling is performed.
When the transfer is completed, the rest of the data will also be transferred.

Example

Retrieves the number of data that are transferred from the user memory.

C, C++

long Ret;
long AiTransferCount;
Ret = AioGetAiTransferCount ( Id , &AiTransferCount );
 

Python

Ret = ctypes.c_long()
AiTransferCount = ctypes.c_long()
Ret.value = caio.AioGetAiTransferCount ( Id , ctypes.byref(AiTransferCount) )