GEN (FB)

 

FUNCTION_BLOCK GEN

Generates periodic functions of different, given types

The generation may be done relative to a specific time base or a given call-count base (BASE). An example set of available types of periodic functions are shown in the following image.

Generator.png

InOut:

Scope

Name

Type

Initial

Comment

Input

MODE

GEN_MODE

Types available:

  • TRIANGLE: Triangular from -AMPLI­TUDE to +AMPLITUDE

  • TRIANGLE_POS: Triangular from 0 to +AMPLITUDE

  • SAWTOOTH_RISE: Sawtooth increasing from -AMPLITUDE to +AMPLITUDE

  • SAWTOOTH_FALL: Sawtooth decreasing from +AMPLITUDE to -AMPLITUDE

  • RECTANGLE: Rectangular switching from -AMPLITUDE to +AMPLITUDE

  • SINE: Sine

  • COSINE: Cosine

BASE

BOOL

FALSE: Period referring to call ( CYCLES)

TRUE: Period referring to time ( PERIOD)

PERIOD

TIME

TIME#1s0ms

Period time, only relevant if BASE = TRUE

CYCLES

INT

1000

Number of calls per period, only relevant if BASE = FALSE

AMPLITUDE

INT

Amplitud of the function to be generated

RESET

BOOL

TRUE: Sets OUT to zero

Output

OUT

INT

Generated function value