![background image](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526022.webp)
7
Function Blocks
Section 1-2
1-2
Function Blocks
1-2-1
Outline
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.
1-2-2
Advantages of Function Blocks
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
Programming
Structured programs created with function blocks have better design quality
and require less development time.
Easy-to-read “Black Box”
Design
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.
Use One Function Block
for Multiple Processes
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).
Input
Output
Input
Output
Output
Function block A
Save function
block as a file.
Program 2
Copy of function block A
Copy of function block A
Copy of function block A
Convert to
library function.
Function
block A
Define in advance.
Insert in
program.
Reuse.
To another PLC program
Variable
Variable Variable
Set
Set
Variable
Variable
Program 1
Standard
program section
written with
variables
Содержание CS1-H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ...viii TABLE OF CONTENTS...
Страница 15: ...xvi Application Precautions 4...
Страница 151: ...136 Procedures Section 3 2...
Страница 153: ...138 Data Types Appendix A...
Страница 177: ...162 External Variables Appendix C...
Страница 181: ...166 Revision History...