Function Blocks
1-2
Function Blocks
1-2-1
Outline
1-2-2
Advantages of Function Blocks
Structured
Programming
Easy-to-read "Black Box"
Design
Use One Function Block
for Multiple Processes
A function block is a basic program element containing a standard processing
function that has been defined in advance. Once the function block has been
defined, the user just has to insert the function block in the program and set
the I/O in order to use the function.
As a standard processing function, a function block does not contain actual
addresses, but variables. The user sets addresses or constants in those vari-
ables. These address or constants are called parameters. The addresses
used by the variables themselves are allocated automatically by the CX-Pro-
grammer for each program.
With the CX-Programmer, a single function block can be saved as a single file
and reused in other PLC programs, so standard processing functions can be
made into libraries.
Function block A
Standard
program section
written with
variables
Define in advance.
Insert in
program.
Save function
block as a file.
Convert to
library function.
Function
block A
Reuse.
Function blocks allow complex programming units to be reused easily. Once
standard programming is created in a function block and saved in a file, it can
be reused just by placing the function block in a program and setting the
parameters for the function block's I/O. The ability to reuse existing function
blocks will save significant time when creating/debugging programs, reduce
coding errors, and make the program easier to understand.
Structured programs created with function blocks have better design quality
and require less development time.
The I/O operands are displayed as variable names in the program, so the pro-
gram is like a "black box" when entering or reading the program and no extra
time is wasted trying to understand the internal algorithm.
Many different processes can be created easily from a single function block by
using the parameters in the standard process as input variables (such as
timer SVs, control constants, speed settings, and travel distances).
Program 2
Program 1
Copy of function block A
Input
Variable Variable
Set
Copy of function block A
Input
Variable Variable
To another PLC program
Section 1-2
Copy of function block A
Output
Variable
Output
Set
Output
7
Need help?
Do you have a question about the CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION and is the answer not in the manual?