Writes to analog outputs immediately.

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

Syntax

Visual Basic (Declaration)
Public Sub WriteAnalog ( _
	channels As Integer(), _
	voltages As Double() _
)
C#
public void WriteAnalog(
	int[] channels,
	double[] voltages
)
Visual C++
public:
void WriteAnalog(
	array<int>^ channels, 
	array<double>^ voltages
)
JavaScript
function writeAnalog(channels, voltages);

Parameters

channels
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: .

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

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

Remarks

The WriteAnalog method writes to the specified analog output channels immediately. The method does not return until the data has been written.

Examples

This example illustrates how to write analog outputs immediately. It writes 0.5V, 1.5V 2.5V and 3.5V to analog channels 0-3 respectively. Exceptions are ignored for simplicity.
C# Copy Code
int []    channels = {  0,   1,   2,   3 };
double [] buffer   = { 0.5, 1.5, 2.5, 3.5 };

card.WriteAnalog(channels, buffer);
Visual Basic Copy Code
Dim channels() As Integer = {0, 1, 2, 3}
Dim buffer() As Double = {0.5, 1.5, 2.5, 3.5}

card.WriteAnalog(channels, buffer)
Visual C++ Copy Code
array<int>^    channels = {  0,   1,   2,   3 };
array<double>^ buffer   = { 0.5, 1.5, 2.5, 3.5 };

card->WriteAnalog(channels, buffer);

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the write cannot be performed then an exception is thrown. This situtation typically arises if the board does not support analog outputs or the hardware resources required are in use by a task.

See Also