EasyManua.ls Logo

Omron NX102-12 Series

Omron NX102-12 Series
578 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Precautions for Correct Use
Amount of Memory That Is Allocated for BOOL Arrays
T
wo bytes are allocated in memory for individual BOOL variables, BOOL structure members, and
BOOL union variables.
However, for a BOOL array, two bytes of memory are not allocated for each element. One bit is
allocated in order for each element. For the entire array, a multiple of two bytes of memory is allo-
cated (including unused bits).
Variable Table
Name
A
B
C
Data type
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL
Variable A
Variable B
Variable C
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
Two bytes are allocated.
Two bytes are allocated
for 5 elements.
Four bytes are allocated
for 19 elements.
Therefore, the following formula gives the amount of memory that is allocated for a BOOL array.
For 1 to 16 elements, 2 bytes are allocated. For 17 to 32 elements, 4 bytes are allocated.
Amount of me
mory = 2
Truncate the decimal portion of the result
of the calculation in brackets.
Number of
elements − 1
16
+2
Specific examples of the rules for memory allocation for variables of each data type are given below.
Basic Data Types
Variables with One-Byte Alignments (e.g., BYTE)
One byte of memory is allocated for the one-byte alignment.
Example: T
wo consecutive BYTE variables
Variable A, 1 byte
Variable B, 1 byte
Variable Table
Name
A
B
Data type
BYTE
BYTE
Bytes
Memory
First byte
First byte + 1
Variables with Two-byte Alignments (e.g., BOOL and WORD)
Two bytes of memory are allocated for the two-byte alignment.
Example: Two consecutive BOOL variables
Appendices
A-48
NJ/NX-series CPU Unit Built-in EtherNet/IP Port Users Manual (W506)

Table of Contents

Related product manuals