Appendices
A-18
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
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 CJ1W-EIP21
Page 8: ...Manual Structure 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 42: ...Revision History 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 68: ...1 Introduction 1 26 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 266: ...9 FTP Server 9 20 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 431: ...Index 1 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 I Index...
Page 436: ...Index 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 Index...
Page 437: ......