![background image](http://html.mh-extra.com/html/omron/sysmac-cp-series/sysmac-cp-series_user-manual_742262052.webp)
4 Understanding Programming
4-8
CP2E CPU Unit Software User’s Manual(W614)
4-3
Function Blocks
Function blocks can be used in programming SYSMAC CP-series PLCs.
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 is not created with actual physical addresses, but
local variables. The user sets parameters (addresses or values) in those variables to use the function
block. The addresses used for the variables themselves are automatically assigned by the system (CX-
Programmer) each time they are placed in the program.
In particular, each function block is saved by the CX-Programmer as an individual file that can be
reused with programs for other PLCs. This makes it possible to create a library of standard processing
functions.
Function blocks allow complex programming units to be reused easily. Once standard program sections
have been created as function blocks and saved in files, they can be reused just by placing a function
block in a program and setting the parameters for the function block
’
s I/O. Reusing standardized func-
tion blocks reduces the time required for programming/debugging, reduces coding errors, and makes
programs easier to understand.
4-3-1
Overview of Function Blocks
4-3-2
Advantages of Function Blocks
cc
aa
bb
#0000
MOV
dd
Standard program
section
w
ritten
w
ith
v
aria
b
les
F
u
nction
b
lock A
Define in ad
v
ance.
Insert in program.
Sa
v
e f
u
nction
b
lock as file.
Li
b
rary
F
u
nction
b
lock A
Re
u
se
To another PLC program
Program 1
Copy of f
u
nction
b
lock A
Inp
u
t
Varia
b
le
Varia
b
le
O
u
tp
u
t
Setting
Setting
Copy of f
u
nction
b
lock A
Inp
u
t
Varia
b
le
Varia
b
le
O
u
tp
u
t
Program 2
Copy of f
u
nction
b
lock A
Varia
b
le
O
u
tp
u
t
Содержание SYSMAC CP Series
Страница 1: ...USER S MANUAL Cat No W614 E1 01 SYSMAC CP Series CP2E E D CP2E S D CP2E N D CP2E CPU Unit Software ...
Страница 3: ......
Страница 32: ...1 Overview 1 4 CP2E CPU Unit Software User s Manual W614 ...
Страница 44: ...3 CPU Unit Operation 3 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 116: ...6 I O Allocation 6 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 144: ...7 PLC Setup 7 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 170: ...10 Interrupts 10 14 CP2E CPU Unit Software User s Manual W614 ...
Страница 200: ...11 High speed Counters 11 30 CP2E CPU Unit Software User s Manual W614 ...
Страница 272: ...12 Pulse Outputs 12 72 CP2E CPU Unit Software User s Manual W614 ...
Страница 278: ...13 PWM Outputs 13 6 CP2E CPU Unit Software User s Manual W614 ...
Страница 460: ...18 Programming Device Operations 18 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 576: ...Revision 2 CP2E CPU Unit Software User s Manual W614 ...
Страница 577: ......