Download CS/CJ Series Programmable Controllers
Transcript
Section 5-2 Manipulating Files Transferring ASCII Files (Not supported by CSseries 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. 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 earlier version is being used, only 0 Hex (.IOM files) can be specified directly. If CX-Programmer V1.2 or a later version (or a Programming 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 earlier version (or a Programming Console) is being used, only 0 Hex (no returns) can be specified directly. If CX-Programmer V1.2 or a later version is being used, the control word bits can be set to 0 Hex or to between 8 and D Hex. CX-Programmer V1.1 or Earlier Version: Indirectly Setting the Control Word When V1.1 or an earlier version of CX-Programmer is being used, ASCII files cannot be transferred with FREAD(700) and FWRIT(701) if a constant is input for the control word to specify the data type and carriage return treatment. Only binary data with no carriage returns can be transferred if a constant is used. ASCII files can be transferred with FREAD(700) and FWRIT(701), however, by indirectly setting the control word. Write the desired control word setting to a word and specify that word as the control word in FREAD(700) or FWRIT(701), as shown on the left in the following diagram. CX-Programmer Versions V1.1 and Earlier Execution condition File Memory Operation Flag Write #1800 to W000. Specify W000 as C. CX-Programmer Versions V1.2 and Later Execution condition File Memory Operation Flag Specify #1800 as C. Note The time from the CPU Unit’s internal clock is used to date files created in file memory with FWRIT(701). Only one file memory operation may be executed at a time, so FREAD(700) and FWRIT(701) must not be executed when any of the following file memory operations are being performed: 1,2,3... 1. Execution of FREAD(700) or FWRIT(701) 207