987
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
File Memory Instructions
3
FREAD
z Operand Specifications
Flags
Related Auxiliary Area Flags and Words
Function
z Reading Data (Third Digit of C = 0)
FREAD(700) reads the number of words or fields specified in S1 and S1+1 from the file specified in S2
(with filename extension .IOM, .TXT, or .CSV) beginning at the address specified in S1+2 and S1+3.
The data is then written to RAM beginning at the word specified in D.
Area
Word addresses
Indirect DM/EM
addresses
Con-
stants
Registers Flags
Pulse
bits
TR
bits
CIO WR HR AR T C DM EM
@DM
@EM
*DM
*EM
DR IR
Indirect
using IR
TK CF
C
OK OK OK OK OK OK OK OK
--- --- OK
--- --- OK --- --- --- ---S1, S2
OK OK ---
D
Name Label Operation
Error Flag ER • ON if the file memory specified in C does not exist.
• ON if the settings in C are not within the specified range.
• ON if the filename specified in S2 does not satisfy the required conditions.
• ON if the File Memory Operation Flag was ON.
• ON if a constant was not specified for C (only for CS-series CS1 CPU Units prior to V1@).
• ON if data specified for S1 is out of range (all CPU Units except for CS-series CS1 CPU Units prior to
V1@).
• ON if an illegal area is specified for D.
• With the CS1D CPU Units: ON if the active and standby CPU Units could not be synchronized.
• OFF in all other cases.
Name Address Operation
Memory Card Type A343.00 to A343.02 Contains a binary number indicating the type of Memory Card, if any, that is installed.
(0: None, 4: Flash ROM)
Memory Card Format Error Flag A343.07 ON when the Memory Card is not formatted or a formatting error has occurred.
File Read Error Flag A343.10 ON when a file could not be read because its data was corrupted or if it contains the
wrong data type.
File Missing Flag A343.11 ON when data could not be read because the specified file does not exist.
File Memory Operation Flag A343.13 ON for any of the following:
• The CPU Unit has sent a FINS command to itself using CMND(490).
• FREAD(700) or FWRIT(701) are being executed.
• The program is being overwritten using a control bit in memory.
• A simple backup operation is being performed.
• Use this flag as an execution condition to prevent a file memory instruction from being
executed while another is in progress.
Accessing File Flag A343.14 ON when file data is actually being accessed.
Memory Card Detected Flag A343.15 ON when a Memory Card has been detected.
EM File Memory Format Error Flag A343.06 ON when there is a format error in the starting bank of EM file memory.
Number of Data to Transfer A346 to A347 The contents of these words indicate the status of data file transfers.
When an FREAD(700) or FWRIT(701) instruction is executed, the number of words or
fields to be transferred is written to these words. The value is decremented by 1 as each
word or field is transferred.
A346 contains the rightmost 16 bits and A347 contains the leftmost 16 bits of the 32-bit
binary value.
D
CPU Unit
Starting read address
specified in S1+2 and S1+3
File specified
in S2
Number of words specified
in S1 and S1+1
Memory Card or EM file memory
(Specified by the 1st digit of C.)