Function Blocks; Overview Of Function Blocks; Advantages Of Function Blocks - Omron SYSMAC CP Series User Manual

Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

4 Understanding Programming
4-3

Function Blocks

Function blocks can be used in programming SYSMAC CP-series PLCs.
4-3-1

Overview of Function Blocks

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.
Standard program
section written
with variables
aa
cc
bb
MOV
#0000
dd
4-3-2

Advantages of Function Blocks

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-8
Function block A
Program 1
Define in advance.
Insert in program.
Save function
block as file.
Library
Function
block A
To another PLC program
Reuse
Program 2
Copy of function block A
Input
Output
Variable
Variable
Setting
Setting
Copy of function block A
Input
Output
Variable
Variable
CP2E CPU Unit Software User's Manual(W614)
Copy of function block A
Output
Variable

Advertisement

Table of Contents
loading

Table of Contents