Writes to analog outputs immediately using raw D/A converter values.

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

Syntax

Visual Basic (Declaration)
Public Sub WriteAnalogCodes ( _
	channels As Integer(), _
	values As Integer() _
)
C#
public void WriteAnalogCodes(
	int[] channels,
	int[] values
)
Visual C++
public:
void WriteAnalogCodes(
	array<int>^ channels, 
	array<int>^ values
)
JavaScript
function writeAnalogCodes(channels, values);

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

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

An array containing the raw D/A converter values to write to the analog outputs. Each element in the values array corresponds to the same element in the channels array. Hence, there must be as many elements in the values array as there are channels.

Remarks

The WriteAnalogCodes method writes to the specified analog output channels immediately using raw D/A converter values. The method does not return until the data has been written.

Examples

This example illustrates how to write analog outputs immediately using raw D/A converter values. It writes to analog channels 0-3 respectively. Exceptions are ignored for simplicity.
C# Copy Code
int [] channels = {   0,     1,     2,     3   };
int [] buffer   = { 0x000, 0x3ff, 0x5ff, 0x7ff };

card.WriteAnalogCodes(channels, buffer);
Visual Basic Copy Code
Dim channels() As Integer = {0, 1, 2, 3}
Dim buffer() As Integer = {&H000, &H3ff, &H5ff, &H7ff}

card.WriteAnalogCodes(channels, buffer)
Visual C++ Copy Code
array<int>^ channels = {  0,   1,   2,   3 };
array<int>^ buffer   = { 0x000, 0x3ff, 0x5ff, 0x7ff };

card->WriteAnalogCodes(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