13
Function Blocks Section 1-2
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.
Supports Nesting and
Multiple Languages
Mathematical expressions can be entered in structured text (ST) language.
With CX-Programmer Ver. 6.0 and later versions, function blocks can be
nested. The function block nesting function allows just special processing to
be performed in a ST-language function block nested within a ladder-lan-
guage function block.
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.
2. Variable Definitions
The variable table lists each variable’s usage (input, output, input-output, or
internal) and properties (data type, etc.). For details, refer to 1-3 Variables.
Number of Function Block
Definitions
The maximum number of function block definitions that can be created for one
CPU Unit is either 128 or 1,024 depending on the CPU Unit model.
Function block (ladder language)
Call (Nesting)
Function block (ST language)
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