FrequencyGenerator_M241: Commanding a Square Wave Signal

Overview

The Frequency Generator function block commands a square wave signal output at the specified frequency.

Graphical Representation (LD/FBD)

This illustration is a Frequency Generator function block:

G-SE-0027946.2.gif-high.gif

 

 

IL and ST Representation

To see the general representation in IL or ST language, refer to the Differences Between a Function and a Function Block chapter.

Input Variables

This table describes the input variables:

Inputs

Type

Comment

EN_Enable

BOOL

TRUE = authorizes the Frequency Generator enable via the IN_EN input (if configured).

F_Enable

BOOL

TRUE = enables the Frequency Generator.

EN_SYNC

BOOL

TRUE = authorizes the restart via the IN_SYNC input of the internal timer relative to the time base (if configured).

F_SYNC

BOOL

On rising edge, forces a restart of the internal timer relative to the time base.

Frequency

DWORD

Frequency of the Frequency Generator output signal in tenths of Hz.

(Range: min 1 (0.1Hz)...max 1,000,000 (100kHz)

Output Variables

This table describes the output variables:

Outputs

Type

Comment

InFrequency

BOOL

TRUE = the Frequency Generator signal is output at the specified Frequency.

FALSE =

oThe required frequency cannot be reached for any reason.

oF_Enable is set to False.

oEN_Enable is set to False or no signal detected on the physical input EN Input (if configured).

Busy

BOOL

Busy is used to indicate that a command change is in progress: the frequency is changed.

Set to TRUE when the Enable command is set and the frequency is changed.

Reset to FALSE when InFrequency or Error is set, or when the Enable command is reset.

Error

BOOL

TRUE = indicates that an error was detected.

ErrID

FREQGEN_PWM_ERR_TYPE

When Error is set: type of the detected error.

NOTE: When the required frequency cannot be reached for any reason, the InFrequency output is not set to TRUE, but Error stays to FALSE.

NOTE:  Outputs are forced to 0 when the logic controller is in the STOPPED state.