![Omron Sysmac NX1P2-10 1 Series User Manual Download Page 550](http://html1.mh-extra.com/html/omron/sysmac-nx1p2-10-1-series/sysmac-nx1p2-10-1-series_user-manual_1633435550.webp)
A-5 Variable Memory Allocation Methods
You must be aware of the way in which memory is allocated to variables to align the memory locations
of the members of structure or union variables with variables in other devices. Adjustments are neces-
sary mainly when structure or union variables are used in the following type of communications with
other devices.
• When using EtherNet/IP tag data links or CIP messages to access variables between NJ/NX-series
CPU Units and other CPU Units
• When using structure or union variables to exchange data with devices other than CPU Units, such
as ID Tags
A-5-1
Variable Memory Allocation Rules
The amount of memory and the memory locations that are allocated for a variable depend on the data
type of the variable. The amount of memory and the memory locations that are allocated for array ele-
ments, structure members, and union members depend on the data types, but also on the declara-
tions that are made for the arrays, structures, and unions.
Data Type Alignment and Memory Allocation Amounts
The data size is determined for each data type. The data size is the minimum amount of memory that
is required to store the value or values of that data type.
On the other hand, memory for variables is automatically structured by the Controller for the most effi-
cient access. Therefore, the total amount of memory that is required for variables is not necessarily the
total of the data sizes of the variables. For example, if WORD and DWORD variables are declared, the
total of the data sizes is six bytes, but eight bytes are allocated in memory, as shown in the following
figure.
Variable Table
Name
A
B
Data type
WORD
DWORD
Variable A
Variable B
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
WORD data: 2 bytes
Not used: 2 bytes
DWORD data: 4 bytes
This information for determining the location of a variable in memory is called the alignment. The align-
ment is determined for each data type. The amount of memory and the memory locations for the varia-
bles are given below.
Item
Specification
Amount of memory that is allo-
cated
An integral multiple of the alignment. However, the minimum amount
of memory is the data size.
Appendices
A-46
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User’s Manual (W506)
Summary of Contents for Sysmac NX1P2-10 1 Series
Page 8: ...Manual Structure 6 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 34: ...Revision History 32 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 388: ...9 Socket Service 9 34 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 430: ...12 FTP Client 12 14 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 569: ...I Index I 1 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506 I...
Page 576: ...Index I 8 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 577: ......