AioSetAiTransferSize


Function

Sets the transfer size for user buffer mode.

Format

Ret = AioSetAiTransferSize ( Id, AutoMode, TransferSize )

Parameters

Id [ C, C++ : short ] [ Python : ctypes.c_short ]
Specify the ID obtained by the AioInit function.

AutoMode [ C, C++ : short ] [ Python : ctypes.c_short ]
Specify the method of setting the transfer size from the following range.

Macro

Value

 

AI_TRANSFERSIZE_MANUAL

0

Set the transfer size manually

AI_TRANSFERSIZE_AUTO

1

Set the transfer size automatically

TransferSize [ C, C++ : long ] [Python : ctypes.c_long]
Specify the transfer size when the transfer size setting method is set to manual.
Transfer size is specified in number of packets.

Please specify 0 if the transfer size setting method is set to auto.

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.

20001

This function can't be used by this device

20002

Can not use while by another device works
To use this function, analog input 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.

22520

An internal driver error has occurred.

22521

The AutoMode value is out of the range of the device used.

22522

The TransferSize value is out of the range of the device used.

Initial value

The initial value for all devices is as follows
AutoMode = 1
TransferSize = Since the transfer size is set automatically, it varies depending on the device.

AI-1664UG-PE
AIO-163202G-PE
AIO-163202UG-PE
AIO-123202G-PE
AIO-123202UG-PE

1

Remarks

Set the transfer size for one transfer in user buffer mode.

When the transfer size is set automatically, the transfer size automatically set by the device driver differs depending on the clock type.

For internal clock

A transfer size is set according to the sampling clock period.

For external clock

The transfer size is fixed for each device.

Device used

Transfer size

AIO-163202G-PE
AIO-123202G-PE

5

AI-1664UG-PE
AIO-163202UG-PE
AIO-123202UG-PE

50

 

If you set the transfer size manually, you can set any transfer size in number of packets.
Increasing the transfer size reduces the CPU usage rate and stabilizes operation, but the data transfer interval becomes longer.
Reducing the transfer size shortens the data transfer interval, but the CPU usage rate increases and operation may become unstable.

Depending on the transfer size, the number of transfer data may not advance when the clock is input, but sampling is still performed.
When the transfer is completed, the remaining data will also be transferred.

Cannot be set while sampling is in progress
For automatic setting, the transfer size is fixed at the timing of executing the AioStartAi function.
Even if the sampling clock period is changed during sampling operation, the transfer size will not change.

The set transfer size can be obtained with the AioGetAiTransferSize function.

Example

Sets the transfer size to auto.

C, C++

long Ret;
Ret = AioSetAiTransferSize ( Id , AI_TRANSFERSIZE_AUTO , 0 );
 

Python

Ret = ctypes.c_long()
Ret.value = caio.AioSetAiTransferSize ( Id , caio.AI_TRANSFERSIZE_AUTO , 0 )