Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Windows Target   

Frequency Output - Generate and output a pulse-width-modulated square wave

Library

Real-Time Windows Target

Description

The Frequency Output block generates a pulse-width-modulated square wave that alternates between low (0) and high (1) with a specified frequency and duty cycle. The frequency is specified in Hertz. The duty cycle is specified as a decimal fraction between 0 and 1 inclusive. This fraction specifies the amount of time that the output signal value is high (1). For example, a duty cycle of .7 specifies that the output is high 70% of the time, and low 30% of the time.

After you have added a Frequency Output block to your model, double-click the Frequency Output block to open the Block Parameters: Frequency Output dialog box. The default appearance of the dialog box is:

Specify parameter values as needed, then click OK or Apply. If you specify a non-default value for Output signal frequency source or Output signal duty source, the appearance of the dialog box changes as shown below. The parameters are:

Sample time

Enter the same value you entered in the Fixed step size box from the Configuration Parameters dialog box, or an integer multiple of that value.

Output channels

A vector that selects the output channels you are using on this board. The vector can be any valid MATLAB vector form.

Output signal frequency source

The source that specifies the frequency to output. The frequency is specified in Hertz. The Output signal frequency source can be either of the following:

external (Default)

The frequency is specified by an input signal. An input port appears on the block to accept the signal. A Frequency initial value and a Frequency final value may be needed.

internal

The frequency is specified by a tunable parameter named Frequency. If you specify internal, Frequency replaces Frequency initial value, and Frequency final value is disabled:

Frequency

This tunable parameter appears when Output signal frequency source is internal. Specify the desired frequency in Hertz.

Frequency initial value

This parameter appears when Output signal frequency source is external. Optionally specify a frequency in Hertz. The specified frequency takes effect when you connect to the target, and persists until simulation starts, at which time the value of the frequency signal takes effect. You can use this parameter to specify initial conditions and give them time to stabilize. If no value appears, connecting to the target has no effect on the frequency.

Frequency final value

This parameter appears when Output signal frequency source is external. Optionally specify a frequency in Hertz. The specified frequency takes effect when simulation completes and persists indefinitely. Disconnecting from the target does not affect the frequency. You can use this parameter to put a connected device into a safe or neutral state after simulation. If no value appears, the frequency in effect at the end of simulation persists afterwards.

Output signal duty source

The source that specifies the duty cycle. The specification is a decimal fraction between 0 and 1 inclusive that determines the amount of time that the output signal value is high (1). For example, a duty cycle of .7 specifies that the output is high 70% of the time, and low 30% of the time. Two duty cycle values have special significance:

0

The output signal is continuously low (0) regardless of any frequency specification currently in effect.

1

The output signal is continuously high (1) regardless of any frequency specification currently in effect.

The Output signal duty source can be either of the following:

internal (Default)

The duty cycle is specified by a tunable parameter named Duty.

external

The duty cycle is specified by an input signal. An input port appears on the block to accept the signal. If you specify external, Duty initial value replaces Duty, and Duty final value is enabled:

Duty

This tunable parameter appears when Output signal duty source is internal. Specify the desired duty cycle as a decimal fraction between 0 and 1. Specifying 0 or 1 overrides the currently specified frequency and enforces a continuously low or high output signal for the duration of the specification.

Duty initial value

This parameter appears when Output signal duty source is external. Optionally specify a duty cycle. The specified duty cycle takes effect when you connect to the target, and persists until simulation starts. If no value appears, connecting to the target has no effect on the duty cycle. You can specify any duty cycle. Often the Duty initial value is 0 or 1, enforcing a continuously low or high initial output signal. Specifying 0 or 1 overrides any Frequency initial value.

Duty final value

This parameter appears when Output signal duty source is external. Optionally specify a duty cycle. The specified duty cycle takes effect when simulation completes and persists indefinitely. Disconnecting from the target does not change the duty cycle. If no value appears, the duty cycle in effect at the end of simulation persists indefinitely afterwards. You can specify any duty cycle. Often the Duty final value is 0 or 1, enforcing a continuously low or high initial output signal. Specifying 0 or 1 overrides any Frequency final value.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS