Function blocks

Function Blocks (FB) are small programs. In contrast to functions, function blocks have their own memory area in which values can be stored. Depending on the value stored, which can be added to, subtracted from, etc., the same input values provide different results. You can use the same function block as often as you like in your program. For this reason, each time you load a function block, a copy is created. Give this copy (instance) a name so its values are neither overwritten nor processed by a function block of the same type.

Control FPWIN Pro7 provides two types of function blocks:

  1. System function blocks

    • IEC standard library: e.g. TON, TOF

    • FP library: e.g. CT_FB, PID_FB

  2. User-defined function blocks

    These function blocks can be written in four programming languages:

    • Ladder diagram (LD) or Function block diagram (FBD)

    • Structured text (ST)

    • Instruction list (IL)

      Example

      If you call up the FB "TON" (timer with switch-on delay) of the IEC Standard Library for the first time, e.g. to switch on a motor with delay, this FB could have the name "delay_motor". The next time you call up this FB you give it a different name, e.g. "delay_heating", etc.

NOTE
  • Do not assign a function block to a task, because a function block can be called up by a program or function block only.

  • A function block cannot be called recursively.

  • The maximum of 5 nested function block calls, e.g. FB1(FB2(FB3(FB4(FB5(x))))), may not be exceeded.

Related topics:

Modified on: 2019-12-10Feedback on this pagePanasonic hotline