A-13
Appendices
NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (W506)
A-4 Variable Memory Allocation Methods
App
A-4-1 Variable Memory Allocation Rules
Array variables are stored in a continuous section of memory.
Example:
A continuous section of memory is allocated based on the alignment value of the data type of the struc-
ture variable to store structure data.
Example:
Array Variables
Structure Variables
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
Variable B
Variable C[1..5]
Variable D[0..18]
Variable E[5..8]
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
Stored with
a two-byte
alignment.
Size is 1 bit.
Variable Table
Name
Variable A
Data type
ARRAY[0..4] OF INT
Variable Table
Variable A [0]
Variable A [1]
Variable A [2]
Variable A [3]
Variable A [4]
Memory
Stored with a two-byte alignment.
Data Type Definitions
Name
Structure A
a
b
c
Data type
STRUCT
DINT
INT
DINT
Variable Aa
Variable Ab
Variable Ac
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
Stored with
a two-byte alignment.
Not used.
Stored with
a four-byte alignment.
Stored with
a four-byte alignment.
Variable Table
Name
Variable A
Data type
Structure A