![background image](http://html1.mh-extra.com/html/omron/sysmac-cj1w-eip21/sysmac-cj1w-eip21_operation-manuals_742257384.webp)
Appendices
A-10
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
A-4
Variable Memory Allocation Methods
You must be aware of the way in which memory is allocated to variables to align the memory locations
of the members of structure or union variables with variables in other devices. Adjustments are neces-
sary mainly when structure variables are used in the following type of communications with other
devices.
•
When using EtherNet/IP tag data links or CIP messages to access variables between NJ-series CPU
Units and other CPU Units
•
When using structure variables to exchange data with devices other than CPU Units, such as ID Tags
The amount of memory and the memory locations that are allocated for a variable depend on the data
type of the variable. The amount of memory and the memory locations that are allocated for array ele-
ments, structure members, and union members depend on the data types, but also on the declarations
that are made for the arrays, structures, and unions.
The data size is determined for each data type. The data size is the minimum amount of memory that is
required to store the value or values of that data type. On the other hand, memory for variables is auto-
matically structured by the Controller for the most efficient access. Therefore, the total amount of mem-
ory that is required for variables is not necessarily the total of the data sizes of the variables. For
example, if WORD and DWORD variables are declared, the total of the data sizes is six bytes, but eight
bytes are allocated in memory, as shown in the following figure.
This information for determining the location of a variable in memory is called the alignment. The align-
ment is determined for each data type. The amount of memory and the memory locations for the vari-
ables are given below.
A-4-1
Variable Memory Allocation Rules
Data Type Alignment and Memory Allocation Amounts
Item
Specification
Amount of memory that is allocated
An integral multiple of the alignment. However, the minimum amount of
memory is the data size.
Locations in memory
At an integral multiple of the alignment starting from the start of the vari-
able in memory.
Variable Table
Name
A
B
Data type
WORD
DWORD
Variable A
Variable B
Bytes
Memory
First byte
First byte + 1
First byte + 2
First byte + 3
First byte + 4
First byte + 5
First byte + 6
First byte + 7
WORD data: 2 bytes
Not used: 2 bytes
DWORD data: 4 bytes
Содержание SYSMAC CJ1W-EIP21
Страница 8: ...Manual Structure 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 10: ...Sections in this Manual 8 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 20: ...Read and Understand this Manual 18 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 42: ...Revision History 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 68: ...1 Introduction 1 26 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 80: ...2 Installing Ethernet Networks 2 12 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 130: ...6 Testing Communications 6 4 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 206: ...7 Tag Data Link Functions 7 76 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 246: ...8 Message Communications 8 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 266: ...9 FTP Server 9 20 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 374: ...13 Troubleshooting 13 56 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Страница 431: ...Index 1 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 I Index...
Страница 436: ...Index 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 Index...
Страница 437: ......