7 File Operations
7-18
CJ2 CPU Unit Software User’s Manual
• Structure of CSV and TXT Data Files with Double-word Fields
The following illustration shows the data structure of a CSV data file (ABC.CSV) with double-
word fields containing four words from I/O memory: 1234 Hex, 5678 Hex, 9ABC Hex, and DEF0
Hex.
Additional Information
Creating Data Files with Spreadsheet Software
Use the following procedure to create TXT and CSV data files with spreadsheet software such
as Microsoft Excel.
• Set the cell contents to characters.
• Input 4 characters in each cell if single-word fields are being used or 8 characters if double-
word fields are being used. For example, if single-word fields are being used input 000A, not
just A.
• Be sure to input only hexadecimal characters (0 to 9, A to F, or a to f) in the cells. Other char-
acters and codes cannot be used.
When you want to store hexadecimal digits in I/O memory, it is helpful to convert the spread-
sheet's decimal inputs to hexadecimal. Use the following procedure to convert to hexadecimal.
(1) Select Add-Ins... from the Tools Menu.
(2) Select Analysis ToolPak in the Add-Ins Menu.
(3) Select Function from the Insert Menu at the cell where the function will be used.
(4) Select DEC2HEX (number, digits) from Engineering in the Category Field.
(5) When converting to 4-digit hexadecimal, input the following at the number variable:
IF(0<=cell location,cell location,65535+cell location)
When converting to 8-digit hexadecimal, input the following at the number variable:
IF(0<=cell location,cell location,4294967296+cell location)
Example 1: Inputting Non-negative Decimal Values
Item
Converting unsigned decimal to 4-digit hexa-
decimal
Converting unsigned decimal to 8-digit hexa-
decimal
Function
used
DEC2HEX(cell_location,4) DEC2HEX(cell_location,8)
Example Input 10 in decimal and convert to 000A in 4-digit
hexadecimal.
Input 10 in decimal and convert to 0000000A in 8-
digit hexadecimal.
1234
5678
9ABC
DEF0
36
37
31
38
32
33
34
35
6
7
1
8
2
3
,
4
5
56781234, DEF09ABC
2C
I/O memory
Contents of ABC.CSV
to
8 bytes
Converted to
ASCII
(Upper word first)
Delimiter
The file displayed as text.