8
Function Blocks
Section 1-2
Reduce Coding Errors
Coding mistakes can be reduced because blocks that have already been
debugged can be reused.
Data Protection
The variables in the function block cannot be accessed directly from the out-
side, so the data can be protected. (Data cannot be changed unintentionally.)
Improved Reusability with
Variable Programming
The function block’s I/O is entered as variables, so it isn’t necessary to change
data addresses in a block when reusing it.
Creating Libraries
Processes that are independent and reusable (such as processes for individ-
ual steps, machinery, equipment, or control systems) can be saved as func-
tion block definitions and converted to library functions.
The function blocks are created with variable names that are not tied to actual
addresses, so new programs can be developed easily just by reading the def-
initions from the file and placing them in a new program.
Compatible with
Multiple Languages
Mathematical expressions can be entered in structured text (ST) language.
1-2-3
Function Block Structure
Function blocks consist of function block definitions that are created in
advance and function block instances that are inserted in the program.
Function Block
Definitions
Function block definitions are the programs contained in function blocks. Each
function block definition contains the algorithm and variable definitions, as
shown in the following diagram.
1. Algorithm
Standardized programming is written with variable names rather than real I/O
memory addresses. In the CX-Programmer, algorithms can be written in
either ladder programming or structured text.
tim_a
TIMER
tim_b
TIMER
ON_TIME
INT
OFF_TIME
INT
TIMX tim_a OFF_TIME
tim_b
TIMX tim_b ON_TIME
tim_a
ENO
Name
Type
Internal
Internal
Input
Input
Function Block Definition
Example: CLOCK PULSE
Algorithm
Example: CLOCK PULSE
1. Algorithm
2. Variable Definitions
Variable definitions
Usage
Summary of Contents for CS1-H Series
Page 3: ...iv...
Page 5: ...vi...
Page 7: ...viii TABLE OF CONTENTS...
Page 15: ...xvi Application Precautions 4...
Page 151: ...136 Procedures Section 3 2...
Page 153: ...138 Data Types Appendix A...
Page 177: ...162 External Variables Appendix C...
Page 181: ...166 Revision History...