6-47
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-3 Variables
6
6-3-6 Derivative Data Types
Enumeration Specifications
Notation to Use an Enumerator as a Function Block or Function Parameter
There are the following two notations that you can use to specify an enumerator for a function or
function block parameter.
Enumerator Only
For a function or function block for which the parameter specifies an enumerator, you can just spec-
ify the enumerator.
Example: Passing an Enumerator to the BCDToBins_WORD Instruction
Enumeration#Enumerator Notation
For a function or function block for which the data type of the parameter is not specified, specifying
just the enumerator is not valid. A building error will occur. To clarify that the parameter is an enu-
merator, the following notation is used: Enumeration#Enumerator.
Example: Passing an Enumerator to the MOVE Instruction
Item Specification
Enumerator names Enumerator names consist of single-byte alphanumeric characters. They are not case
sensitive. A building error will occur if you specify the same enumerator more than
once. A building error will occur if you specify an enumerator with the same name as a
variable in the user program or if you specify an enumerator that already exists in
another enumeration.
Values Valid range: Integers between 2,147,483,648 and 2,147,483,647
Values do not have to be consecutive.
A compiling error will occur if you specify the same value more than once.
Note You cannot perform size comparisons with enumeration variables. You can only
test to see if the enumerators are the same.
Number of enumera-
tors
1 to 2,048
FB
IN
(Color)
Color#red
Enumeration Table
Variable Table
ENUMColor
Data type
0red
1yellow
2
green
ColorDiscColor
Variable name Data type
Value
Enumerator
BinToBCDs_WORD
The Format input variable to the BinToBCDs_WORD is specified as an enumerator.
Therefore, it is necessary to specify only the enumerator.
_BCD1
INT#1234
BCDdata
EN
In
Format
ENO
MOVE
The data type of the In input variable is not specified.
To pass an enumerator, use the Enumeration#Enumerator notation.
Color#red ColorA
EN
In
ENO
Out