A-17
Appendices
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
A-4 Variable Memory Allocation Methods
App
A-4-1 Variable Memory Allocation Rules
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 Alignment [bytes] Amount of memory that is allocated [bytes]
E2 4
F2 4
G2 8
H2 8
Data Type Definitions
Name
Structure STR_C
a
b
Data type
STRUCT
ARRAY[0..7] OF BOOL
BYTE
Variable E,
4 bytes
Variable F,
4 bytes
Variable G,
8 bytes
Variable H,
8 bytes
E.a[0] to E.a[7]
E.b
F.c
F.d[0] to F.d[7]
G[0].a[0] to G[0].a[7]
G[0].b
G[1].a[0] to G[1].a[7]
G[1].b
H[0].c
H[0].d[0] to H[0].d[7]
H[1].c
H[1].d[0] to H[1].d[7]
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 + 12
First byte + 13
First byte + 14
First byte + 15
First byte + 16
First byte + 17
First byte + 18
First byte + 19
First byte + 20
First byte + 21
First byte + 22
First byte + 23
Variable Table
Name
Variable E
Variable F
Variable G
Variable H
Data type
Structure STR_C
Structure STR_D
ARRAY[0..1] OF STR_C
ARRAY[0..1] OF STR_D
Name
Structure STR_D
c
d
Data type
STRUCT
BYTE
ARRAY[0..7] OF BOOL
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.
Not used.