Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 979

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
Table of Contents

Advertisement

3. Instructions
Reading Number of Words of Data (Third Digit of C=1)
FREAD(700) finds the number of words in the file specified in S2 (with filename extension .IOM) and
writes that 8-digit hexadecimal value to D and D+1.
Memory Card or EM file memory
Hint
• When another file memory related operation (file memory format, file copy, file delete, etc.) is
executed from the ladder program, send the file memory related FINS command to the local CPU
Unit with a CMND(490) instruction.
• Write the path name and filename in ASCII beginning with the leftmost byte of S2, as shown in the
following example for \ABC\XYZ.IOM. (The .IOM extension is added automatically.)
Precaution
• During normal instruction processing, FREAD(700) is used only to start reading file memory. The
instruction execution times given toward the end of this manual are thus the times required to start
reading, not to complete it. Actual reading (transfer) is performed by the file access processing in
peripheral servicing. Therefore, once FREAD(700) has been executed, reading is continuously
executed even if the execution condition is OFF in following cycles.
The time required to complete data transfer for FREAD(700) will depend on the amount of data being
transferred, the service time allocated to file access processing, and other conditions. As a guideline,
the transfer times for a cycle time of 10 ms for a file in the root directory with the default service time
settings will be 0.92 s for 1,024 words and 4.64 s for 9,999 words.
• When transfer has been completed, the File Memory Operation Flag (A343.13) will turn OFF. This
flag can be used for exclusive control of file memory instructions.
• Data is stored in order by absolute internal memory addresses, so the output data will overwrite data
in the next data area if it exceeds the capacity of the data area specified in D. See Precautions for
more details.
• When FREAD(700) is executed, the number of words (or fields) specified in S1 and S1+1 is written to
A346 and A347 (Number of Data to Transfer) and this value is decremented by 1 as each word or
field is transferred. The content of these words can be checked to verify that the expected number of
words or fields were transferred.
• If the specified number of words or fields exceeds the number of words in the data file, the data in the
file will be transferred normally and no error will occur.
• If the specified starting word exceeds the number of words in the data file, the File Read Error Flag
(A343.10) will be turned ON and the file data will not be read.
• If the specified file or directory does not exist, the File Missing Flag (A343.11) will be turned ON and
the file data will not be read.
• The File Memory Operation Flag (A343.13) will be turned ON when FREAD(700) is executed. An
error will occur and the instruction will not be executed if A34313 is already ON.
• The File Read Error Flag (A343.10) will be turned ON and the instruction will not be executed if the
specified file contains the wrong data type or the file data is corrupted. For text or CSV files, the
character code must be hexadecimal data and delimiters must be every 4 digits for word data and
every 8 digits for double-word data. Data will be read up to the point where an illegal character is
detected.
942
File specified
in S2
Number of
words
S2
"\"
"A"
"B"
"C"
S2+1
"\"
"X"
S2+2
"Y"
"Z"
S2+3
NUL
S2+4
CPU Unit
Number of words
written to D and D+1.
S2
5C
41
42
43
S2+1
5C
58
S2+2
59
5A
S2+3
S2+4
00
CS/CJ/NSJ Series Instructions Reference Manual (W474)

Advertisement

Table of Contents
loading

Table of Contents