Omron sysmac NX102-9 Series Owner's Manual page 548

Machine automation controller, cpu unit built-in ethernet/iptm port
Table of Contents

Advertisement

Appendices
Arrays
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
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)
Example: INT array with five elements
First byte +
(integer multiple of 2)
First byte +
A[0]
(integer multiple of 2)
First byte +
A[1]
(integer multiple of 2)
First byte +
A[2]
(integer multiple of 2)
First byte +
A[3]
(integer multiple of 2)
A[4]
Structures
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.
Variable
A
B
C
D
A-58
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
First byte + 10
First byte + 11
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
Alignment [bytes]
4
8
4
8
4
16
4
16
Variable Table
Name
A
Variable A,
B
2 bytes
C
Variable B,
D
2 bytes
E
Variable C,
2 bytes
Variable D,
4 bytes
Variable E,
2 bytes
Variable Table
Name
Variable A
Variable A,
10 bytes
Amount of memory that is allocated [bytes]
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User's Manual (W506)
Data type
BOOL
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL
ARRAY[5..8]OF BOOL
Data type
ARRAY[0..4] OF INT

Advertisement

Table of Contents
loading

Table of Contents