Omron CX-PROGRAMMER V8.1 Operation Manual page 39

Function blocks/ structured text
Table of Contents

Advertisement

Function Blocks
Instances
Number of Instances
14
To use an actual function block definition in a program, create a copy of the
function block diagram and insert it in the program. Each function block defini-
tion that is inserted in the program is called an "instance" or "function block
instance." Each instance is assigned an identifier called an "instance name."
By generating instances, a single function block definition can be used to pro-
cess different I/O data with the same function.
Not yet in program
and memory not yet
allocated
(abstract).
Function Block Definition FB1
1. Algorithm
Standard
program unit
with variable
names a, b, c,
etc.
2. Parameters
Table defining usage
and properties of
variables a, b, c, etc.
Note
Instances are managed by names. More than one instance with the same
name can also be inserted in the program. If two or more instances have the
same name, they will use the same internal variables. Instances with different
names will have different internal variables.
For example, consider multiple function blocks that use a timer as an internal
variable. In this case all instances will have to be given different names. If
more than one instance uses the same name, the same timer would be used
in multiple locations, resulting in duplicated use of the timer.
If, however, internal variables are not used or they are used only temporarily
and initialized the next time an instance is executed, the same instance name
can be used to save memory.
Function Block Definition
TIMER_FB
Variable Definitions
Internal variable: WORK_NUM
Multiple instances can be created from a single function block definition. Up to
either 256 or 2,048 instances can be created for a single CPU Unit depending
on the CPU Unit model. The allowed number of instances is not related to the
number of function block definitions and the number of tasks in which the
instances are inserted.
Block instance in program with memory
allocated. (object)
Program
Instance
Instance FB1_1 of function block definition FB1
Insert in
program.
Input
a
data
Insert in
program.
Instance FB1_2 of function block definition FB1
Input
a
data
instance_A
TIMER_FB
instance_A
TIMER_FB
instance_B
TIMER_FB
Memory
used
Automatic
allocation
Memory
b
for FB1_1
Output data
c
Output data
Memory
Automatic
for FB1_2
allocation
Different I/O data
can be processed
with the same
function.
b
Output data
c
Output data
Use same internal variables.
Use different internal variables.
Section 1-2

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents