quanser.hardware.hil.set_clock_frequency quanser.hardware.hil.set_digital_directions navigation bar

Table of Contents

quanser.hardware.hil.set_clock_mode

Sets the modes of the specified hardware clocks.

Syntax

err = board.set_clock_mode(clocks, modes)
    

Description

Sets the modes of the specified hardware clocks. There are two possible modes for hardware clocks:

Mode

Name

Comment

0

CLOCK_TIMEBASE_MODE

Use clock as hardware timebase - the default

1

CLOCK_PWM_MODE

Use clock as PWM output

Mode 0 configures the clock as a hardware timebase so it may be used with the HIL task-based I/O functions. This mode is the default if no mode is configured.

Mode 1 configures the clock as a PWM output so it may be used with the HIL PWM output functions. This mode is not available on many data acquisition cards.

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.

clocks

A vector of clock numbers for which the modes should be set. Hardware clocks are numbered incrementally starting at 0, with 0 meaning HARDWARE_CLOCK_0, 1 meaning HARDWARE_CLOCK_1, etc. The number of clocks available depends on the board selected. Refer to Clocks for more information.

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

modes

A vector of clock modes with each element been the mode for the corresponding element in the clocks parameter. The clock modes are described above.

Outputs

err

A negative error code or zero on success.

Examples

board.set_clock_mode(0, 1);    % Sets hardware clock 0 to PWM mode.
    

See Also

 

navigation bar