AioSetAiAttachedData


Function

Sets the attached data that are attached to the AD conversion data.
This function can only be used for the device with the bus-master transfer functionality.
AI-1204Z-PE is not supported.

This function is available when the transfer mode of the conversion data is set to the user buffer mode by AioSetAiTransferMode function. 
This function cannot be used when the transfer mode of the conversion data is the device buffer.

Format

Ret = AioSetAiAttachedData ( Id , AttachedData )

Parameters

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

AttachedData [ C, C++ : long ] [ Python : ctypes.c_long ]
Specifies the type of the attached data that are attached to the AD conversion data from the following range in macro or value.
AttachedData is used in bit, so they can be combined to use. 

Attached data

Macro

Value

Attached information of analog input

AIAT_AI

00000001H

Data of analog output

AIAT_AO0

00000100H

Data of digital input and output

AIAT_DIO0

00010000H

Data of counter channel 0

AIAT_CNT0

00100000H

Data of counter channel 1

AIAT_CNT1

00200000H

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.

Initial value

In all devices, AttachedData = 0

Remarks

The following attached data can be selected as the data that are attached to the AD conversion data.

Attached data is transferred to user memory together with conversion data.
Attached data uses a buffer of 4 bytes (1 packet) for all types.

Therefore, please note that the number of packets required for one sampling changes depending on the specified status of attached data.
Use the AioGetAiSamplingDataSize function to get the required number of packets per sampling.

If the device is in operation, the function cannot be performed.

â– Transfer image of attached data

   

Attached data follows AD conversion data.
They are transferred in the following order.
1. Attached information of analog input
2. Data of analog output
3. Data of digital input and output
4. Data of counter channel 0
5. Data of counter channel 1

Regardless of the type of attached data you use, data with the lowest number is transferred first.

For details on each attached data, please refer to the topic "Data attached to AD conversion data" in the glossary.

 

Specifications based on devices

AI-1664UG-PE

Support the following 3 types of attached data.

  1. Attached information of analog input

  2. Data of digital input and output

  3. Data of counter channel 0

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

Support the following 5 types of attached data.

  1. Attached information of analog input

  2. Data of analog output

  3. Data of digital input and output

  4. Data of counter channel 0

  5. Data of counter channel 1

AI-1204Z-PE

The device can specify user buffer mode, but it does not support this API.

 

Example

Sets the attached information of analog input to the attached data.

C, C++

long Ret;
Ret = AioSetAiAttachedData ( Id , AIAT_AI );
 

Python

Ret = ctypes.c_long()
Ret.value = caio.AioSetAiAttachedData ( Id , caio.AIAT_AI )