Sets the mode of the PWM outputs on the card.

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

Syntax

Visual Basic (Declaration)
Public Sub SetPwmMode ( _
	channels As Integer(), _
	modes As Hil..::.PwmMode() _
)
C#
public void SetPwmMode(
	int[] channels,
	Hil..::.PwmMode[] modes
)
Visual C++
public:
void SetPwmMode(
	array<int>^ channels, 
	array<Hil..::.PwmMode>^ modes
)
JavaScript
function setPwmMode(channels, modes);

Parameters

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

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

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

Remarks

The SetPwmMode method sets the modes that will be used for PWM outputs. The mode determines how the values written to a PWM output are interpreted. Refer to the Hil..::.PwmMode enumeration for a list of the valid PWM modes.

The actual PWM output modes are not changed until the PWM outputs are used in one of the following functions:

Examples

This sample illustrates how to use the SetPwmMode(array<Int32>[]()[], array<Hil..::.PwmMode>[]()[]) method. It sets the PWM mode of channel 0 to Hil.PwmMode.DutyCycle and the mode of channel 1 to Hil.PwmMode.Frequency.
C# Copy Code
int []         channels = {           0,                     1,          };
Hil.PwmMode [] modes    = { Hil.PwmMode.DutyCycle, Hil.PwmMode.Frequency };

board.SetPwmMode(channels, modes);
Visual Basic Copy Code
Dim channels() As Integer = {0, 1}
Dim modes() As Hil.PwmMode = {Hil.PwmMode.DutyCycle, Hil.PwmMode.Frequency}

board.SetPwmMode(channels, modes)
Visual C++ Copy Code
array<int>^          channels = {             0,                       1,          };
array<Hil::PwmMode>^ modes    = { Hil::PwmMode::DutyCycle, Hil::PwmMode::Frequency };

board->SetPwmMode(channels, modes);

Exceptions

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

See Also