Reads from analog inputs immediately, returning raw A/D converter values.

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

Syntax

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

Parameters

channels
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 from the list for board-specific details: .

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

An array for receiving the raw A/D converter values read from the analog inputs. 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 ReadAnalogCodes method reads from the specified analog input channels immediately. The data returned is the raw integer A/D converter values, not voltages. The method does not return until the data has been read.

Examples

This example illustrates how to read analog inputs immediately, as raw A/D converter values. It reads analog channels 0-3. Exceptions are ignored for simplicity.
C# Copy Code
int [] channels = { 0, 1, 2, 3 };
int [] buffer   = new int [channels.Length];

card.ReadAnalogCodes(channels, buffer);
Visual Basic Copy Code
Dim channels() As Integer = {0, 1, 2, 3}
Dim buffer(channels.Length - 1) As Integer

card.ReadAnalogCodes(channels, buffer)
Visual C++ Copy Code
array<int>^ channels = { 0, 1, 2, 3 };
array<int>^ buffer   = gcnew array<int>(channels->Length);

card->ReadAnalogCodes(channels, buffer);

Exceptions

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

See Also