Reads from analog inputs and writes to analog outputs immediately.

Namespace:  Quanser.Hardware
Assembly:  Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)

Syntax

Visual Basic (Declaration)
Public Sub ReadAnalogWriteAnalog ( _
	inputChannels As Integer(), _
	outputChannels As Integer(), _
	inputVoltages As Double(), _
	outputVoltages As Double() _
)
C#
public void ReadAnalogWriteAnalog(
	int[] inputChannels,
	int[] outputChannels,
	double[] inputVoltages,
	double[] outputVoltages
)
Visual C++
public:
void ReadAnalogWriteAnalog(
	array<int>^ inputChannels, 
	array<int>^ outputChannels, 
	array<double>^ inputVoltages, 
	array<double>^ outputVoltages
)
JavaScript
function readAnalogWriteAnalog(inputChannels, outputChannels, inputVoltages, outputVoltages);

Parameters

inputChannels
Type: array< System..::.Int32 >[]()[]

An array containing the numbers of the analog input channels to be read. Channel numbers are zero-based. Thus, channel 0 is the first channel, channel 1 the second channel, etc.

Select a board type to the list for board-specific details: .

outputChannels
Type: array< System..::.Int32 >[]()[]

An array containing the numbers of the analog output channels to be written. Channel numbers are zero-based. Thus, channel 0 is the first channel, channel 1 the second channel, etc.

Select a board type to the list for board-specific details: .

inputVoltages
Type: array< System..::.Double >[]()[]

An array for receiving the voltage values read from the analog inputs. Each element in the inputVoltages array corresponds to the same element in the inputChannels array. Hence, there must be as many elements in the inputVoltages array as there are channels.

outputVoltages
Type: array< System..::.Double >[]()[]

An array containing the voltage values to write to the analog outputs. Each element in the outputVoltages array corresponds to the same element in the outputChannels array. Hence, there must be as many elements in the outputVoltages array as there are channels.

Remarks

The ReadAnalogWriteAnalog method reads from the specified analog input channels and writes to the specified analog output channels immediately, in a single method call. The write operation occurs immediately following the read operation. Since the read-write operation occurs at the lowest level the read and write occur virtually concurrently. The method does not return until the data has been read and written.

Examples

This example illustrates how to read analog inputs and write analog outputs immediately, in a single operation. It reads analog input channels 0-3 and writes 0.5V and 1.5V to analog output channels 0-1 respectively. Exceptions are ignored for simplicity.
C# Copy Code
int []    inputChannels  = { 0, 1, 2, 3 };
int []    outputChannels = { 0, 1 };

double [] inputBuffer    = new double [inputChannels.Length];
double [] outputBuffer   = { 0.5, 1.5 };

card.ReadAnalogWriteAnalog(inputChannels, outputChannels, inputBuffer, outputBuffer);
Visual Basic Copy Code
Dim inputChannels() As Integer = {0, 1, 2, 3}
Dim outputChannels() As Integer = {0, 1}

Dim inputBuffer(inputChannels.Length - 1) As Double
Dim outputBuffer() As Double = {0.5, 1.5}

card.ReadAnalogWriteAnalog(inputChannels, outputChannels, inputBuffer, outputBuffer)
Visual C++ Copy Code
array<int>^    inputChannels  = { 0, 1, 2, 3 };
array<int>^    outputChannels = { 0, 1 };

array<double>^ inputBuffer    = gcnew array<double>(inputChannels->Length);
array<double>^ outputBuffer   = { 0.5, 1.5 };

card->ReadAnalogWriteAnalog(inputChannels, outputChannels, inputBuffer, outputBuffer);

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the read or write cannot be performed then an exception is thrown. This situtation typically arises if the board does not support this method.

See Also