A-15
Appendices
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
A-4 V
ariab
le Mem
o
ry
Allocation
Meth
od
s
App
A-4-1
V
ar
iab
le Memor
y
Allocation Rules
A continuous section of memory is allocated for the elements of the array based on the data size of the
data type of the array variable. The alignment of an array is the same as alignment of the data type of
the elements.
Example:
Continuous variables in the following order: two BOOL variable, one BOOL array with five
elements, one BOOL array with 19 elements, and one BOOL array with four elements
Example: INT array with five elements
For a structure variable, the members are located in memory in the order that they are declared. Each
member is located at an integer multiple of the alignment of the data type of the member. Therefore,
there can be unused memory between members or at the end of members. The alignment of a struc-
ture is the largest alignment of all of the members. The amount of memory that is allocated is the inte-
gral multiple of the alignment that is larger than the total amount of memory that is allocated when the
members are arranged in order at integral multiples of the alignment of the data types of the members.
Example:
The alignments and the amounts of memory that are allocated for the four variable declara-
tions given in the following figure are given in the following table.
Arrays
Structures
Variable
Alignment [bytes]
Amount of memory that is allocated [bytes]
A
4
8
B
4
8
C
4
16
D
4
16
Variable Table
Name
A
B
C
D
E
Data type
BOOL
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL
ARRAY[5..8]OF BOOL
Variable A,
2 bytes
Variable B,
2 bytes
Variable C,
2 bytes
Variable D,
4 bytes
Variable E,
2 bytes
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
First byte + 8
First byte + 9
First byte + 10
First byte + 11
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
Variable Table
Name
Variable A
Data type
ARRAY[0..4] OF INT
Memory
Bytes
First byte
First byte + 1
First byte + 2
First byte + 3
First byte + 4
First byte + 5
First byte + 6
First byte + 7
First byte + 8
First byte + 9
A[0]
A[1]
A[2]
A[3]
A[4]
Variable A,
10 bytes
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
Содержание 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: ......