11 - 44 11 - 44
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
DATA
Instruction
DATA
• Specifies values and character strings to be read by READ.
DATA <constant> [ <, constant> …]
Syntax
constant
• • • •
Specify any numeric value constant (fixed point
constant, floating point constant, integer constant), or
a character string constant.
Examples
DATA 1, 2, 3
• • • •
Defines the data (1, 2, 3) that is read by the READ
instruction.
Description
• The DATA instruction specifies the data to be read by the READ instruction.
• The DATA instruction is a non-executable instruction and can be written in any place of the
program.
• One DATA instruction can specify as many constants as they fit in one line (255
characters) separated by comma (,).
If the character string constant contains comma (,), colon (:), semicolon (;), or a space
before or after, the constant needs to be enclosed with the double quotation marks (“).
Otherwise, no quotation marks are necessary.
• One program can contain multiple DATA instructions.
• The READ instruction reads data in the ascending order of the line number that contains a
DATA instruction.
• The type of the constant in a DATA instruction and the type of the variable that
corresponds to the READ instruction must match.
The constant of the DATA instruction can be read again from any location by executing a
RESTORE instruction.
• The DATA instruction is normally used in a pair with the READ instruction. See the READ
instruction for details.
• An “Out of DATA” error occurs if there are fewer number of data than the count to be read
by the READ instruction.