# LGF_ClockGen (FB / 1.0.1)

Overview

Author: Simatic Systems Support (SICAR)

## Short description

This function generates the same clock signals as the system clock memory.

### Block Interface

| LGF_ClockGen (FB) |
--- | --- | ---
|  |  |  |  | clockDataType |  |  | LGF_typeSystemClockGen
|  |  |  |  | clockDataTypeRisingEdge |  |  | LGF_typeSystemClockGen
|  |  |  |  | clockDataTypeFallingEdge |  |  | LGF_typeSystemClockGen
|  |  |  |  | clockByte |  |  | Byte
|  |  |  |  | clockByteRisingEdge |  |  | Byte
|  |  |  |  | clockByteFallingEdge |  |  | Byte
|  |  |  |  | clk10Hz |  |  | Bool
|  |  |  |  | clk5Hz |  |  | Bool
|  |  |  |  | clk2Hz5 |  |  | Bool
|  |  |  |  | clk2Hz |  |  | Bool
|  |  |  |  | clk1Hz25 |  |  | Bool
|  |  |  |  | clk1Hz |  |  | Bool
|  |  |  |  | clk0Hz625 |  |  | Bool
|  |  |  |  | clk0Hz5 |  |  | Bool

### Output parameter

Identifier | Data type | Description
--- | --- | ---
clockDataType | LGF_typeSystemClockGen | Clock data type
clockDataTypeRisingEdge | LGF_typeSystemClockGen | Clock edge data type (rising edges)
clockDataTypeFallingEdge | LGF_typeSystemClockGen | Clock edge data type (falling edges)
clockByte | Byte | Clock byte
clockByteRisingEdge | Byte | Clock edge byte (rising edges)
clockByteFallingEdge | Byte | Clock edge byte (falling edges)
clk10Hz | Bool | Clock bit 10Hz
clk5Hz | Bool | Clock bit 5Hz
clk2Hz5 | Bool | Clock bit 2.5Hz
clk2Hz | Bool | Clock bit 2Hz
clk1Hz25 | Bool | Clock bit 1.25Hz
clk1Hz | Bool | Clock bit 1Hz
clk0Hz625 | Bool | Clock bit 0.625Hz
clk0Hz5 | Bool | Clock bit 0.5Hz

## User defined datatype(s)

### LGF_typeSystemClockGen (UDT / V1.0.0)

Clock generator datatype

Identifier | Data type | Default value | Description
--- | --- | --- | ---
clk10Hz | Bool | FALSE | Clock bit 10Hz
clk5Hz | Bool | FALSE | Clock bit 5Hz
clk2Hz5 | Bool | FALSE | Clock bit 2.5Hz
clk2Hz | Bool | FALSE | Clock bit 2Hz
clk1Hz25 | Bool | FALSE | Clock bit 1.25Hz
clk1Hz | Bool | FALSE | Clock bit 1Hz
clk0Hz625 | Bool | FALSE | Clock bit 0.625Hz
clk0Hz5 | Bool | FALSE | Clock bit 0.5Hz

## Functional description

The module generates the clock flags known from the system. It uses the system function `Runtime` and calculates the clock flag states based on the time.

The function block outputs the clocks in three formats:

- Individual Boolean values
- Clock byte
- Clock data type

In addition, the edges (rising and falling edges) are also evaluated and output as bytes and data structure.

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | SICAR
| 01.10.2023 | First released version
| 1.0.1 | Simatic Systems Support
| 06.05.2025 | Integration into LGF