Omron cx-programmer 5.0-function block operation 사용자 설명서

다운로드
페이지 183
13
Variables
Section 1-3
1-3
Variables
1-3-1
Introduction
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:
Note
Constants are not registered as variables. Enter constants directly in instruc-
tion operands.
• Ladder programming language: Enter hexadecimal numerical values
after the # and decimal values after the &.
• Structured text (ST language): Enter hexadecimal numerical values af-
ter 16# and enter decimal numerical values as is.
Exception: Enter directly or indirectly specified addresses for Index Registers
IR0 to IR15 and Data Registers DR0 to DR15 directly into the instruction
operand. 
1-3-2
Variable Usage and Properties
Variable Usage
The following variable types (usages) are supported.
Internals:
Internal variables are used only within an instance. They cannot
be used pass data directly to or from I/O parameters.
Inputs:
Input variables can input data from input parameters outside of
the instance. The default input variable is an EN (Enable) vari-
able, which passes input condition data.
a
b
c
MOV
a
c
b
Name Type
AT
Initial Value
Retained
a
BOOL
c
BOOL
Name Type
AT
Initial Value
Retained
b
BOOL
0.00
a
1
1
3.00
c
0
0
2.00
b
1
1
Input 0.00
Instance of function block definition A
Input 3.00
Output 2.00
Function block definition A
Standard program section with 
variable names a, b, c, etc.
Insert in 
program.
Specify inputs and outputs 
at the same time.
Table indicating usage and 
prpperties of variables a, b, c, etc.
Usage: Inputs
Prpperties:
Usage: Outputs
Prpperties:
Status of 0.00 (1 or 0) is 
passed to a.
Status of b (1 or 0) is 
passed to 2.00.
Status of 3.00 (1 or 0) is 
passed to c.
Program
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.