hil_set_pwm_duty_cycle hil_set_pwm_mode navigation bar

Table of Contents

hil_set_pwm_frequency

Deprecated

The HIL API MATLAB functions have been deprecated in favour of the new quanser.hardware.hil class, which has support for code generation for Quanser targets. Hence, with the new hil class it is possible to run MATLAB scripts in real-time on Quanser targets, while making use of the Quanser hardware.

Sets the frequencies of the specified PWM channels.

Syntax

err = hil_set_pwm_frequency(board, 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 hil_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 handle returned by hil_open.

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.
hil_set_pwm_frequency(board, [0 1], [10000 20000]);
    

See Also

 

navigation bar