Variable Memory Allocation Methods; A-5-1 Variable Memory Allocation Rules - Omron NY532-5400 User Manual

Ny-series ipc machine controller industrial panel pc / industrial box pc
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

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 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 NY-series Con-
trollers and other Controllers
• When using structure variables to exchange data with devices other than Controllers, 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 declarations
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 auto-
matically structured by the Controller for the most efficient access. Therefore, the total amount of mem-
ory 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 A
First byte
First byte + 1
First byte + 2
First byte + 3
Variable B
First byte + 4
First byte + 5
First byte + 6
First byte + 7
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 vari-
ables are given below.
Item
Amount of memory that is allocated
Locations in memory
NY-series Industrial Panel PC / Industrial Box PC Built-in EtherNet/IP Port User's Manual (W563)
Memory
Bytes
WORD data: 2 bytes
Not used: 2 bytes
DWORD data: 4 bytes
An integral multiple of the alignment. However, the minimum amount of
memory is the data size.
At an integral multiple of the alignment starting from the start of the vari-
able in memory.
Appendices
Variable Table
Name
Data type
A
WORD
B
DWORD
Specification
A
A-51

Advertisement

Table of Contents
loading

Table of Contents