Sets the filter frequency 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 SetEncoderFilterFrequency ( _
	channels As Integer(), _
	frequency As Double() _
)
C#
public void SetEncoderFilterFrequency(
	int[] channels,
	double[] frequency
)
Visual C++
public:
void SetEncoderFilterFrequency(
	array<int>^ channels, 
	array<double>^ frequency
)
JavaScript
function setEncoderFilterFrequency(channels, frequency);

Parameters

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

An array containing the numbers of the encoder channels whose filter frequencies 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: .

frequency
Type: array< System..::.Double >[]()[]
An array of doubles containing the new encoder filter frequency for each channel in Hertz. Each element in the frequency array corresponds to the same element in the channels array. Hence, there must be as many elements in the frequency array as there are channels.

Remarks

Some cards support filtering of their encoder inputs. The SetEncoderFilterFrequency method sets the filter frequency of the encoder inputs on the card. Note that many cards do not support encoders. Cards which do provide encoders may not support filtering or different filter frequencies, or may not support different filter frequencies for each channel.

The Quanser Q8-series support programmable filter frequencies and each channel may be assigned a different frequency. The fastest frequency is generally used so that the encoder inputs can handle the fastest possible A/B inputs. A slower filter frequency may be required in noisy environments. However, be aware that noisy encoder inputs is often an indication of a grounding problem or inadequate shielding, so be sure to check ground and shield connections carefully before resorting to more filtering of the encoder inputs. Filter frequencies will be rounded to the nearest filter frequency supported by the card.

Examples

This sample illustrates how to use the SetEncoderFilterFrequency(array<Int32>[]()[], array<Double>[]()[]) method. It sets the filter frequencies of channels 0 and 4 to 8.33 MHz and sets channel 2 to 4.17 MHz. An expression is used for these filter frequencies that yields the exact frequencies that may be used by the Quanser Q8 card. See the documentation for the data acquisition card used for details.
C# Copy Code
int []    channels    = {        0,               2,               4        };
double [] frequencies = { 1 /(120e-9 * 1), 1 /(120e-9 * 2), 1 /(120e-9 * 1) };

board.SetEncoderFilterFrequency(channels, frequencies);
Visual Basic Copy Code
Dim channels() As Integer = {0, 2, 4}
Dim frequencies() As Double = {1 / (0.00000012 * 1), 1 / (0.00000012 * 2), 1 / (0.00000012 * 1)}

board.SetEncoderFilterFrequency(channels, frequencies)
Visual C++ Copy Code
array<int>^    channels    = {        0,               2,               4        };
array<double>^ frequencies = { 1 /(120e-9 * 1), 1 /(120e-9 * 2), 1 /(120e-9 * 1) };

board->SetEncoderFilterFrequency(channels, frequencies);

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the encoder filter frequencies cannot be set then an exception is thrown. This situtation typically arises when given filter frequencies are out of range or the card does not support programmable filter frequencies for its encoders.

See Also