Preparing Groups Of Data - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM

3.5.2 Preparing groups of data

3 - 21
Use the READ and DATA instructions in order to prepare a group of data to be
assigned. These instructions use the READ instruction to obtain the data specified by
the DATA instruction. Try executing the following example.
10 READ A, B, C, D
20 PRINT A, B, C, D
30 DATA 35, 6, -8, 12
RUN
35 6 -8 12
OK
The DATA instruction will be read properly by the READ instruction no matter where
they are placed and no matter how scattered they are. In addition, any character
strings can be used.
10 DATA 51H
20 READ A$, B$, C$
30 DATA MEE
70 DATA TD
80 READ D$
90 DATA PC
However, the following program has a problem.
10 DATA MTC
20 READ BM$, CM$
As shown above, an error will be generated if the DATA instruction does not include a
value that corresponds to a READ instruction.
If a numeric value is specified by the DATA instruction, the following will occur
depending on the variable specified by the READ instruction that reads that data.
10 READ
A$, B%
20 DATA
7, 7
The variables following the READ instruction
correspond to the values following the DATA
instruction as shown below.
A
35
A$
B$
"51H"
"MEE"
BM$
CM$
?
"MTC"
A$
"7"
If a character variable is
specified by the READ
instruction, it is treated
as a character string.
MELSEC-Q
B
C
D
6
- 8
12
C$
D$
"TD"
"PC"
There isn't anything
that corresponds
to CM$.
B%
7
If a numeric variable is
specified by the READ
instruction, it is treated
as a numeric value.
3 - 21

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents