AioSetDemoAi


Function

This is a function that sets the analog input value of the demo device.

Format

Ret = AioSetDemoAi ( Id , AiChannelNum , AiChannel , AiData )

Parameters

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

AiChannelNum [ C, C++ : short ] [ Python : ctypes.c_short ]
Specifies the number of elements in the channel number array.

AiChannel [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the channel number.

AiData [ C, C++ : float * ] [ Python : ctypes.POINTER(ctypes.c_float) ]
Specifies the address of the array that stored the data.

Return values

Ret [ C, C++ : long ] [ Python : ctypes.c_long ]

Return values

Content

0

Normality completion

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.

18023

Pointer to AiChannel, AiData is NULL

28020

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

28021

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

28022

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

28023

A driver inner error occurred

28024

Only available if the waveform type is fixed

Remarks

This is a function dedicated to the demo device.

Only available when the waveform type is "Fixed value" by calling AioSetDemoAiType function.
Values that can be set are allowed outside the range.

You can confirm the current setting range by calling AioGetAiRange function.

And also, please call AioSingleAiEx or AioMultiAiEx function when you want to confirm the current Analog Input values.

 

Example

Sets the analog input value 5V for channel 0 to channel 7.

C, C++

long Ret;
short AiChannel[8];
float AiData[8];
short i;
for( i = 0 ; i < 8 ; i++ ){
    AiChannel[i] = i;
    AiData[i] = 5.0;
}
Ret = AioSetDemoAi ( Id , 8 , &AiChannel[0] , &AiData[0] );
 

Python

Ret = ctypes.c_long()
AiChannelType = ctypes.c_short * 8
AiChannel = AiChannelType()
AiDataType = ctypes.c_float * 8
AiData = AiDataType()
for i in range(8):
    AiChannel[i] = i
    AiData[i] = 5.0
Ret.value = caio.AioSetDemoAi ( Id , 8 , AiChannel , AiData )
 

See also

AioSetDemoAiType, AioGetAiRange, AioSingleAiEx, AioMultiAiEx