Sets the quadrature mode of the encoder inputs on the card.

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

Syntax

Visual Basic (Declaration)
Public Sub SetEncoderQuadrature ( _
	channels As Integer(), _
	mode As Hil..::.Quadrature() _
)
C#
public void SetEncoderQuadrature(
	int[] channels,
	Hil..::.Quadrature[] mode
)
Visual C++
public:
void SetEncoderQuadrature(
	array<int>^ channels, 
	array<Hil..::.Quadrature>^ mode
)
JavaScript
function setEncoderQuadrature(channels, mode);

Parameters

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

An array containing the numbers of the encoder channels whose quadrature modes will be set. 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: .

mode
Type: array< Quanser.Hardware..::.Hil..::.Quadrature >[]()[]
An array of quadrature modes containing the new encoder quadrature mode for each channel. Each element in the mode array corresponds to the same element in the channels array. Hence, there must be as many elements in the mode array as there are channels.

Remarks

The SetEncoderQuadrature method sets the quadrature mode of the encoder inputs on the card. Many cards do not support encoders. Cards which do provide encoders may not support different quadrature modes, or may not support different quadrature modes for each channel. Refer to the Hil..::.Quadrature enumeration for a list of the valid quadrature modes.

The Quanser Q8-series support all the quadrature modes and each channel may be assigned a different mode. The 4X quadrature mode is typically the mode used for encoders because it provides the highest encoder resolution. The non-quadrature mode is used for frequency counting and other applications where count and direction inputs are required rather than standard A/B encoder inputs.

Examples

This sample illustrates how to use the SetEncoderQuadrature(array<Int32>[]()[], array<Hil..::.Quadrature>[]()[]) method. It sets the quadrature mode of channels 0 and 2 to 4X quadrature and set channel 1 to non-quadrature mode.
C# Copy Code
int []            channels = {         0,                 1,                   2         };
Hil.Quadrature [] modes    = { Hil.Quadrature.X4, Hil.Quadrature.None, Hil.Quadrature.X4 };

board.SetEncoderQuadrature(channels, modes);
Visual Basic Copy Code
Dim channels() As Integer = {0, 1, 2}
Dim modes() As Hil.Quadrature = {Hil.Quadrature.X4, Hil.Quadrature.None, Hil.Quadrature.X4}

board.SetEncoderQuadrature(channels, modes)
Visual C++ Copy Code
array<int>^             channels = {          0,                   1,                     2          };
array<Hil::Quadrature>^ modes    = { Hil::Quadrature::X4, Hil::Quadrature::None, Hil::Quadrature::X4 };

board->SetEncoderQuadrature(channels, modes);

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the encoder quadrature modes cannot be set then an exception is thrown. This situtation typically arises when the card does not support one of the quadrature modes specified.

See Also