Omron CJ1W-EIP21 Operation Manuals page 392

For nj-series cpu unit. cj-series ethernet/ip units
Hide thumbs Also See for CJ1W-EIP21:
Table of Contents

Advertisement

Appendices
Unions
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.
Variable
A
B
C
D
First byte +
(integer multiple of 4)
A.a A.b
First byte +
(integer multiple of 4)
B.c B.d
First byte +
(integer multiple of 4)
C[0].a C[0].b
C[1].a C[1].b
First byte +
(integer multiple of 4)
D[0].c D[0].d
D[1].c D[1].d
A-18
Alignment [bytes]
Amount of memory that is allocated [bytes]
4
4
4
4
4
8
4
8
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
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
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
Data Type Definitions
Name
Data type
Union UNI_A
UNION
a
DWORD
Variable A,
b
WORD
4 bytes
Name
Data type
Union UNI_B
UNION
c
WORD
Variable B,
d
DWORD
4 bytes
Variable Table
Name
Data type
Variable A
Union UNI_A
Variable C,
Variable B
Union UNI_B
8 bytes
Variable C
ARRAY[0..1] OF UNI_A
Variable D
ARRAY[0..1] OF UNI_B
Variable D,
8 bytes

Advertisement

Table of Contents
loading

Table of Contents