AioSetAiChannel


Function

Sets the analog input channel used for conversion to be used/unused.
This function is used by Z-series only.

Format

Ret = AioSetAiChannel ( Id , AiChannel, Enabled )

Parameters

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

AiChannel [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies the channel you want to set to be used/unused.

Enabled [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Sets the channel to be used/unused.

0

Unused channel

1

Used channel

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.

12480

The value of AiChannel is outside the designated range of the function

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.

22480

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

Initial value

All devices, channel 0 is used,
and channel 1, channel 2, channel 3 are unused.

Remarks

This function cannot be used on devices without the analog input function.
If the device is in operation, the function cannot be performed.
This function is used by Z-series only.

Notes that data handling differs between when specifies device buffer to transfer mode and when specifies user buffer to transfer mode.
(For transfer mode, please refer to AioSetAiTransferMode.)

 

Device buffer mode

When setting the channels to be used in device buffer mode,
the data is stored in ascending order of channel number.

For example, when using 2 channels in total, 0ch and 3ch,
the data is stored as shown  in the figure on the right.

...
 

Similarly, when using 3 channels in total, 0ch, 2ch and 3ch,
the data is stored as shown  in the figure on the right.

 

...

User buffer mode

When setting channels to be used in user buffer mode as well as device buffer mode, the data is stored in ascending order of channel number.



For example, when using 2 channels in total, 0ch and 2ch,
the data is stored as shown  in the figure on the right.

...
 

Similarly, when using 3 channels in total, 0ch, 2ch and 3ch,
the data is stored as shown  in the figure on the right. 

However, if the number of channels to be used is odd, as shown in the tutorial [User buffer setting]
It is necessary to note that the  invalid data is included in the upper 2 bytes in one packet.

  ...
                                                             
 

 

Example

Sets the set channel to be used/unused.

VB.NET

Dim Ret As Integer
Dim AiChannel As Short
Dim Enabled As Short
Ret = AioSetAiChannel ( Id , AiChannel, Enabled )
 

C, C++

long Ret;
short AiChannel;
short Enabled;
Ret = AioSetAiChannel ( Id , AiChannel, Enabled );
 

C#

int Ret;
short AiChannel;
short Enabled;
Ret = aio.SetAiChannel ( Id ,AiChannel, Enabled );
 

Python

Ret = ctypes.c_long()
AiChannel = ctypes.c_short()
Enabled = ctypes.c_short()
Ret.value = caio.AioSetAiChannel ( Id , AiChannel, Enabled )
 

See also

AioGetAiChannel AioGetAiChannels AioGetAiMaxChannels