When using device buffer mode for transfer mode, set the output data
by using function AioSetAoSamplingData
or AioSetAoSamplingDataEx.
The function AioSetAoSamplingData sets conversion data in binary value,
and the function AioSetAoSamplingDataEx sets conversion data in voltage
or current value.
Ret = AioSetAoSamplingData ( Id , AoSamplingTimes , AoData )
Ret = AioSetAoSamplingDataEx ( Id , AoSamplingTimes , AoData )
In AoSamplingTimes, set the number of generating times.
The number of generating times means the number of times conversion is
performed, and it is irrelevant to the number of channels used for conversion.
Since the device (driver) memory is limited memory of 256 x 1024 data, the total number of samples that can be stored in memory varies depending on the channel to be used.
Number of Channels |
Maximum number of generatings that can be stored in memory |
1 |
256x1024/1 = 262144 |
2 |
256x1024/2 = 131072 |
... |
|
8 |
256x1024/8 = 32768 |
... |
|
16 |
256x1024/16 = 16384 |
In AoData, specify a pointer to the array that stores the output data.
For AioSetAoSamplingData, the analog output data is stored in binary value.
The range is 0 to 4095 for a 12-bit resolution device and 0 to 65535 for
a 16-bit resolution device.
For AioSetAoSamplingDataEx, the analog output data is stored in voltage
or current value.
Please make sure that the size of array is larger than [number of channels
* number of generating times] set by function AioSetAoChannels.
Set the output data in the following order.
When the output mode is transparent
output, the output is done in the order 0, 1, 2, ....
When the output mode is synchronous output,
data is outputted at the same time.
How to use AioSetAoSamplingData and AioSetAoSamplingDataEx differs depending on the memory type to be used.
The output data is specified in binary value.
The conversion from voltage value to binary value is performed by the following
formula.
Binary value = Resolution * ( Voltage value - Minimum range value )
/ ( Maximum range value - Minimum range value )
The resolution is 4096 for 12-bit, 65535 for 16-bit.
e.g.) Analog output range : -5 to 5V, Resolution : 12-bit, convert voltage
value 2.5V to binary value
binary value = 4095 * ( 2.5 - (-5) ) / ( 5 - (-5) ) ≈ 3071