Mitsubishi QD51 Programming Manual page 123

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

Advertisement

6 I/O Processing of Data Files
• PRINT #n, A;B
• PRINT #n , A ; " , " ; B
Sequential
Data File
EOF Function
6 - 5
When handling numeric data
When writing numeric data into a sequential file, the numeric value is written after
automatically converting into the character data. Also, when reading data from a
sequential file as numeric data, the written character data will be automatically
converted into the numeric values. Therefore, data from a sequential file that is
comprised only with numbers can be treated as character data or numeric data.
Example
Assume
A = 80.5
B = 13.15
When numeric data is written, spaces will automatically be written similar to the PRINT
instruction for the screen.
For details on controlling spaces, see Section 3.10.
In this case, there is no separator between 80.5 and 13.15, so the contents of the data
file will be treated as one data.
Also, spaces are ignored when using numeric data in BASIC, but since data such as
80.513.15 is not valid as a single number, and an error will be generated.
To treat these as two separate data, a comma is used as follows.
Because BASIC treats commas (,) as separators, the data will be treated as two
separate data.
When reading data from a sequential file, the data will always be read in order starting
from the beginning. When there is no more data to be read, an "INPUT past end" error
will be generated.
The EOF function is used to avoid this error. The EOF function will be "TRUE" when
there is no more data to be read, and this function can be judged by the IF instruction.
INPUT #n, • • •
(0)
8
0
.
Contents of data file
8
0
.
5
Contents of data file
INPUT #n, • • •
(0)
MELSEC-Q
[CR] [LF]
5
1
3
.
1
5
[CR] [LF]
,
1
3
.
1
5
INPUT #n, • • •
INPUT #n, • • •
EOF
ERROR
(1)
6 - 5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents