quanser.hardware.hil.set_pwm_duty_cycle quanser.hardware.hil.set_pwm_mode navigation bar

Table of Contents

quanser.hardware.hil.set_pwm_frequency

Sets the frequencies of the specified PWM channels.

Syntax

err = board.set_pwm_frequency(channels, frequencies)
    

Description

Sets the frequencies of the specified PWM channels. This function is typically used only in PWM_DUTY_CYCLE_MODE (the default). Refer to the set_pwm_mode function for details on PWM modes.

If no err output is provided then it throws an exception if an error occurs. In generated code it prints the error message. Use hil_get_error_message to get the message associated with an error code.

Parameters

board

The board instance returned by the quanser.hardware.hil.open function.

channels

A vector of channel numbers. Channel numbers are zero-based.

Select a board type from the list for board-specific details: .

frequencies

A vector of frequencies in Hertz. There must be one element for each channel in the channels vector.

Outputs

err

A negative error code or zero on success.

Examples

% Sets PWM channel 0 to 10 kHz and channel 1 to 20 kHz.
board.set_pwm_frequency([0 1], [10000 20000]);
    

See Also

 

navigation bar