![background image](http://html.mh-extra.com/html/omron/sysmac-ny512-1300/sysmac-ny512-1300_user-manual_742451444.webp)
Appendices
A-58
NY-series Industrial Panel PC / Industrial Box PC Built-in EtherNet/IP Port User’s Manual (W563)
For a union variable, the members overlap in the same memory locations. The alignment of a union is
largest alignment of all of the members. The amount of memory that is allocated is the largest amount
of memory that is allocated for any 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.
Unions
Variable
Alignment [bytes]
Amount of memory that is allocated [bytes]
A
4
4
B
4
4
C
4
8
D
4
8
Data Type Definitions
Name
Union
UNI_A
a
b
Data type
UNION
DWORD
WORD
Variable A,
4 bytes
Variable B,
4 bytes
Variable C,
8 bytes
Variable D,
8 bytes
A.a A.b
B.c B.d
C[0].a C[0].b
C[1].a C[1].b
D[0].c D[0].d
D[1].c D[1].d
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 A
Variable B
Variable C
Variable D
Data type
Union
UNI_A
Union
UNI_B
ARRAY[0..1] OF UNI_A
ARRAY[0..1] OF UNI_B
Name
Union
UNI_B
c
d
Data type
UNION
WORD
DWORD
First byte +
(integer multiple of 4)
First byte +
(integer multiple of 4)
First byte +
(integer multiple of 4)
First byte +
(integer multiple of 4)
Summary of Contents for Sysmac NY512-1300
Page 459: ......