AioSetAiMemoryType


Function

Sets the memory type for storing data. The meanings is different with the transfer mode that is decided by AioSetAiTransferMode.

Format

Ret = AioSetAiMemoryType ( Id , AiMemoryType )

Parameters

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

AiMemoryType [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the memory type for storing data from the following range.

Device buffer

0

FIFO

1

RING

User buffer

0

Not overwrite the memory

1

Overwrite the memory

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.

11080

The value of AiMemoryType is outside the designated range of the function
Set 0(FIFO) or 1(RING) to AiMemoryType.

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.

21080

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

Initial value

In all devices, it is FIFO when the device buffer is used, or it is "Not overwrite the memory" when the user buffer is used.

Remarks

Memory type of the device buffer

1. FIFO

In FIFO (First In First Out) format, as normal the converted data is written to the memory after the latest data, the oldest data is read from the memory. 

If the memory is full and an addition data is going to be written, the overflow error occurs and the conversion stops.

In FIFO, the data can be read when AD conversion is performing. In order to avoid the memory overflow, you should read the data periodically and the long time sampling over the memory capacity can be performed.

Use the FIFO format to retrieve all of conversion data. It can be used for the analog input in various conditions from the specified number of sampling to infinity sampling.

2. RING

In RING format, the conversion data are written in-order, the old conversion data are overwritten when the storage exceed the upper limit of the memory. The data can be read from the optional location. Reading of data is performed on the basis of the current data writing position.

Use RING format to retrieve the data in specific condition. For example, if the data before and after External Trigger Stop is required, or you want to read the data just after the command (AioStopAi) is executed, use the RING memory.

Memory type of the user buffer

1. Not overwrite the memory

The conversion data transfer doesn't stop until the end of user buffer.
It is valid memory format when the number of sampling is confirmed in advance.

2. Overwrite the memory

The conversion data transfer doesn't stopped even if the end of user buffer is reached.
Overwrite the memory until the conversion stop condition is satisfied.
It can be used for the long time monitor, or all of data are necessary in infinity sampling.

 

This function cannot be used on devices without the analog input function.
If the device is in operation, the function cannot be performed.

Example

Sets the memory to store the data in FIFO.

C, C++

long Ret;
Ret = AioSetAiMemoryType ( Id , 0 );
 

Python

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

See also

AioGetAiMemoryType