A
A-4 CP1L Programming Examples
SYSMAC CP1L Getting Started Guide
151
Ap
pend
ix
z
Function Blocks
Function blocks are programming elements (templates) that group a set of
processes (functions) into a single block. The user can define a function block in
advance, and then use it by simply inserting it into a program and setting its I/O.
Create and save standard program sections as function blocks. The function
blocks can then be placed in a program, and be easily reused by simply setting the
I/O parameters.
Take a ladder program for "Device 1 Control".
Replace the program I/Os with parameters. Save the algorithm as a template.
The template is defined as a function block (FB).
The defined function block can be used in ladder programs as function block
instances.
Xn
TIM
n
#0100
Yn
Zn
Bn
An
Tn
Processing
(algorithm)
X1
TIM
1
#0100
Y1
Z1
B1
A1
T1
Program elements
Outputs
Xn
Yn
Zn
Inputs
An
Bn
[Device 1 Control]
[Device n Control]
A1
B1
X1
Y1
Z1
P On
A2
B2
X2
Y2
Z2
Z
P On
Device Control
Device Control
EN
A
B
ENO
X
Y
A
B
Z
X
Y
A
B
X
Y
EN
ENO
Device Control
Z
Set I/O parameters
EN
ENO
Define as function block
Insert function block instance
into ladder program
[Device 1 Control]
[Device 2 Control]
W07E-EN-02+CP1L+GettingStartedGuide.book Seite 151 Montag, 15. September 2008 11:15 11