Sets the count values for the encoder counters.
Namespace:
Quanser.Hardware
Assembly:
Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub SetEncoderCounts ( _
channels As Integer(), _
counts As Integer() _
) |
C# |
---|
public void SetEncoderCounts(
int[] channels,
int[] counts
) |
Visual C++ |
---|
public:
void SetEncoderCounts(
array<int>^ channels,
array<int>^ counts
) |
JavaScript |
---|
function setEncoderCounts(channels, counts); |
Parameters
- channels
- Type: array<
System..::.Int32
>[]()[]
An array containing the numbers of the encoder channels whose counter values 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:
.
- counts
- Type: array<
System..::.Int32
>[]()[]
An array of count values to which to set the encoder counters. Each element in
the counts array corresponds to the same
element in the channels array.
Hence, there must be as many elements in the counts
array as there are channels.
Remarks
Examples
This sample illustrates how to use the
SetEncoderCounts(array<Int32>[]()[], array<Int32>[]()[]) method.
It sets the count values of three encoder channels. Channel 0 is set to 1000, channel 1 is set to -1000
and channel 3 is set to 0.
C# | Copy Code |
---|
int [] channels = { 0, 1, 3 };
int [] counts = { 1000, -1000, 0 };
board.SetEncoderCounts(channels, counts);
|
Visual Basic | Copy Code |
---|
Dim channels() As Integer = {0, 1, 3}
Dim counts() As Integer = {1000, -1000, 0}
board.SetEncoderCounts(channels, counts)
|
Visual C++ | Copy Code |
---|
array<int>^ channels = { 0, 1, 3 };
array<int>^ counts = { -1000, 1000, 0 };
board->SetEncoderCounts(channels, counts);
|
Exceptions
Exception | Condition |
---|
Quanser.Hardware..::.HilException |
If the encoder counts cannot be set then an exception is thrown. This situtation
typically arises when the card does not support encoders.
|
See Also