4-9
4 Understanding Programming
CP2E CPU Unit Software User’s Manual(W614)
4-3 Function Blocks
4
4-3-2 Advantages of Function Blocks
Structured programs created with function blocks have better design quality and required less devel-
opment time.
z Easy-to-read “Block Box” Design
The I/O operands are displayed as local variable names in the program, so the program is like a
“black box” when entering or reading the program and no extra time is wasted trying to understand
the internal algorithm.
z Different Processes Easily Created from a Single Function Block
Many different processes can be created easily from a single function block by using input variables
for the parameters (such as timer SVs, control constants, speed settings, and travel distances) in the
standard process.
z Reduced Coding Errors
Coding mistakes can be reduced, because blocks that have already been debugged can be reused.
z Data Protection
The local variables in the function block cannot be accessed directly from the outside, so the data
can be protected. (Data cannot be changed unintentionally.)
z Improved Reusability through Programming with Variables
The function block’s I/O is entered as local variables, so the data addresses in the function block do
not have to be changed as they do when copying and reusing a program section.
Processes that are independent and reusable (such as processes for individual steps, machinery,
equipment, or control systems) can be saved as function block definitions and converted to library
functions.
The function blocks are created with local variable names that are not tied to physical addresses, so
new programs can be developed easily just by reading the definitions from the file and placing them
in a new program.
Mathematical expressions can be entered in structured text (ST) language.
Nesting function blocks is supported. For example, it is possible to express only special operations
in ST language within a function block in a ladder diagram.
For details on using function blocks, refer to the CX-Programmer Ver. 7.0 Operation Manual: Func-
tion Blocks (Cat. No. W447).
Structured Programming
Creating Libraries
Nesting Multiple Languages
Function block (ladder language)
Call (Nesting)
Function block (ST language)