225
Manipulating Files Section 5-2
FREAD(700)/FWRIT(701) Instructions
FREAD(700) and FWRIT(701) transfer data between I/O memory and file
memory. All CJ CPU Units can transfer binary data (.IOM files) and the V1
CPU Units can also transfer ASCII files (.TXT and .CSV files).
Note This instruction can be used in CPU Units with unit version 4.0 or later.
Transferring ASCII Files
(Not supported by CS-
series CS1 CPU Units that
are pre-EV1)
ASCII files can be transferred as well as binary files, so the third and fourth
digits of the instruction’s control word operand (C) indicate the type of data file
being transferred and the number of fields between carriage returns.
CPU Unit
FREAD(700)/FWRIT(701): Transfers
between I/O memory and file memory
CMND(490): File memory operations
(Not possible for CS-series CPU Units that are pre-EV1)
CPU Unit
CMND
instruction
Operation
Operation
Memory Card
EM file memory
Memory Card
EM file memory
I/O memory
I/O memory
I/O memory
I/O memory
FREAD/FWRIT
instruction
Name Mnemonic Description
READ DATA
FILE
FREAD(700) Reads specified data file data or data elements
to specified I/O memory.
WRITE DATA
FILE
FWRIT(701) Uses specified I/O memory area data to create
a specified data file.
WRITE TEXT
FILE (See note.)
TWRIT(704)
Creates a text file from ASCII data in the speci-
fied I/O memory data area location.
Bits in C Settings Programming Device
limitations
12 to 15 Data type
0: Binary (.IOM)
1: Non-delimited words (.TXT)
2: Non-delimited double-words (.TXT)
3: Comma-delimited words (.CSV)
4: Comma-delimited double-words (.CSV)
5: Tab-delimited words (.TXT)
6: Tab-delimited double-words (.TXT)
If CX-Programmer V1.1 or an
lower version is being used,
only 0 Hex (.IOM files) can be
specified directly.
If CX-Programmer V1.2 or a
higher version (or a Program-
ming Console) is being used,
the control word bits can be
set to between 0 and 6 Hex.
08 to 11 Carriage returns
0: No returns
8: Return every 10 fields
9: Return every 1 field
A: Return every 2 fields
B: Return every 4 fields
C: Return every 5 fields
D: Return every 16 fields
If CX-Programmer V1.1 or an
lower version (or a Program-
ming Console) is being used,
only 0 Hex (no returns) can
be specified directly.
If CX-Programmer V1.2 or a
higher version is being used,
the control word bits can be
set to 0 Hex or to between 8
and D Hex.