AioSetDemoAiType


Function

Sets the waveform type used for the analog input value of the demo device.

Format

Ret = AioSetDemoAiType ( Id , AiChannelNum , AiChannel , AiType , AiPeriod )

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.

AiType [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the waveform type.

0

Fixed value

1

Sin wave

2

Triangle wave

3

Square wave

AiPeriod [ C, C++ : short * ] [ Python : ctypes.POINTER(ctypes.c_short) ]
Specifies the address of the array that stored the period (number of 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.

18044

Pointer to AiChannel, AiType, AiPeriod is NULL

28040

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

28041

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

28042

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

28043

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

28044

A driver inner error occurred

Remarks

This is a function dedicated to the demo device.

The initial value is fixed value: 0V.
Please call AioSetDemoAi function to modify Analog Input value when the Demo AI Type is "fixed" type.

The one cycle of waveform is indicated by "AiPeriod" parameter.
The minimum and maximum of the waveform match the range setting of the demo device.
You can confirm the current range by calling AioGetAiRange function.

Please call AioSingleAiEx or AioMultiAiEx function when you confirm the current Analog Input values.

Example

Sets the waveform type "Sin wave" used for the analog input value for channel 0 to channel 7.
The period (number of data) is 1000.

C, C++

long Ret;
short AiChannel[8];
short AiType[8];
short AiPeriod[8];
short i;
for( i = 0 ; i < 8 ; i++ ){
    AiChannel[i] = i;
    AiType[i] = 1;
    AiPeriod[i] = 1000;
}
Ret = AioSetDemoAiType ( Id , 8 , &AiChannel[0] , &AiType[0] , &AiPeriod[0] );
 

Python

Ret = ctypes.c_long()
AiChannelType = ctypes.c_short * 8
AiChannel = AiChannelType()
AiTypeType = ctypes.c_short * 8
AiType = AiTypeType()
AiPeriodType = ctypes.c_short * 8
AiPeriod = AiPeriodType()
for i in range(8):
    AiChannel[i] = i
    AiType[i] = 1
    AiPeriod[i] = 1000
Ret.value = caio.AioSetDemoAiType ( Id , 8 , AiChannel , AiType , AiPeriod )
 

See also

AioSetDemoAi, AioGetAiRange, AioSingleAiEx, AioMultiAiEx