# LGF_Frequency (FB / V3.0.1)

Author: Siemens Industry Support

## Short description

This function generates a signal that changes between the values `FALSE` and `TRUE` depending on a defined frequency and a pulse pause ratio.

### Block Interface

| LGF_Frequency (FB) |
--- | --- | ---
Real |  |  | frequency |  | clock |  |  | Bool
Real |  |  | pulsePauseRatio |  | countdown |  |  | Time

### Input parameter

Identifier | Data type | Default value | Description
--- | --- | --- | ---
frequency | Real | 0.0 | Clock frequency in Hz.
pulsePauseRatio | Real | 1.0 | Pulse pause ratio (standard: 1.0 corresponds to 1:1).

### Output parameter

Identifier | Data type | Description
--- | --- | ---
clock | Bool | Output changes with defined frequency.
countdown | Time | Remaining time of the current `clock` state.

## Functional description

The `clock` output is a Boolean value that toggles at the desired frequency. The `pulsePauseRatio` input is used to set the pulse pause ratio.

The output `countdown` outputs the remaining time of the current state of `clock`.

If the desired frequency or pulse pause ratio is less than or equal to `0.0`, the output `clock` = FALSE and `countdown` = `0s`.

###### Example

Note
  The `clock` of the FB LGF_Frequency depends on the cycle time of the OB Main. To increase the accuracy, the FB can also be called in a cyclic interrupt OB with a low time interval.

## Change log

Version & Date | Change description
--- | ---
| 01.00.00 | Siemens Industry Online Support
| 19.08.2015 | First released version
| 01.01.00 | Siemens Industry Online Support
| 25.05.2016 | New function: pulse pause ratio
| 01.01.01 | Siemens Industry Online Support
| 26.05.2016 | Add comments
| 01.01.02 | Siemens Industry Online Support
| 02.01.2017 | Upgrade: TIA Portal V14 Update 1
| 01.01.03 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 01.01.04 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 01.00.07 | Simatic Systems Support
| 20.09.2019 | Code refactoring, regions and more comments added
| 03.00.00 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 03.00.01 | Simatic Systems Support
| 15.02.2021 | Insert documentation