Variables; Introduction - Omron CX-PROGRAMMER V8.1 Operation Manual

Function blocks/ structured text
Table of Contents

Advertisement

Variables

Registration of Instances
1-3

Variables

1-3-1

Introduction

Note
18
Each instance name is registered in the global symbol table as a file name.
Program
Instance (sample) of function block definition A
a
b
c
The instance is registered in the
global symbol table with the instance
name as the symbol name.
Name
Data type
sample FB [FunctionBlock1]
The function block definition
name is registered after FB in
square parentheses [ ].
Instance name
In a function block, the addresses (see note) are not entered as real I/O mem-
ory addresses, they are all entered as variable names. Each time an instance
is created, the actual addresses used by the variable are allocated automati-
cally in the specified I/O memory areas by the CX-Programmer. Conse-
quently, it isn't necessary for the user to know the real I/O memory addresses
used in the function block, just as it isn't necessary to know the actual mem-
ory allocations in a computer. A function block differs from a subroutine in this
respect, i.e., the function block uses variables and the addresses are like
"black boxes."
Example:
Function block definition A
Standard program section with
variable names a, b, c, etc.
b
a
c
MOV
Table indicating usage and
properties of variables a, b, c, etc.
Usage: Inputs
Properties:
Name Type
AT
Initial Value
Retained
a
BOOL
c
BOOL
Usage: Outputs
Properties:
Name Type
AT
Initial Value
Retained
b
BOOL
Constants are not registered as variables. Enter constants directly in instruc-
tion operands.
Address/
value
N/A[Auto]
Program
Instance of function block definition A
Insert in
program.
Input 0.00
a
Input 3.00
c
Specify inputs and outputs
at the same time.
Status of 0.00 (1 or 0) is
passed to a.
0.00
a
1
1
Status of 3.00 (1 or 0) is
passed to c.
3.00
c
0
0
The system automatically allocates the
addresses used by variables a, b, and c. For
example, when W100 to W120 is set as the
system's non-retained memory area, bit
addresses such as a = W10000, b = W10001,
and c = W10002 will be allocated.
Section 1-3
Output 2.00
b
Status of b (1 or 0) is
passed to 2.00.
b
2.00
1
1

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