Omron CJ2 CPU - REV 10-2010 User Manual page 270

Cj2 cpu unit software
Table of Contents

Advertisement

7 File Operations
• 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.
I/O memory
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
Function
used
Example
7-18
5
35
6
Converted to
36
ASCII
37
7
1234
(Upper word first)
8
38
5678
1
31
9ABC
2
32
DEF0
3
33
34
4
,
2C
to
Contents of ABC.CSV
Converting unsigned decimal to 4-digit hexa-
decimal
DEC2HEX(cell_location,4)
Input 10 in decimal and convert to 000A in 4-digit
hexadecimal.
8 bytes
56781234, DEF09ABC
The file displayed as text.
Delimiter
Converting unsigned decimal to 8-digit hexa-
DEC2HEX(cell_location,8)
Input 10 in decimal and convert to 0000000A in 8-
digit hexadecimal.
CJ2 CPU Unit Software User's Manual
decimal

Advertisement

Table of Contents
loading

Table of Contents