A-3-2 Basic Data Types - Omron NX-series User Manual

Safety network controller communication control unit built-in function
Hide thumbs Also See for NX-series:
Table of Contents

Advertisement

Appendices
Precautions for Correct Use
Amount of Memory That Is Allocated for BOOL Arrays
Two 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 A
Variable B
Variable C
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 memory = 2
Specific examples of the rules for memory allocation for variables of each data type are given below.
A-3-2
Basic Data Types
Variables with One-Byte Alignments (e.g., BYTE)
One byte of memory is allocated for the one-byte alignment.
Example: Two consecutive BYTE variables
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
A - 18
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
Number of
elements − 1
16
Truncate the decimal portion of the result
of the calculation in brackets.
Memory
Bytes
Variable A, 1 byte
Variable B, 1 byte
NX-series Communication Control Unit Built-in Function User's Manual (Z396)
Two bytes are allocated.
Two bytes are allocated
for 5 elements.
Four bytes are allocated
for 19 elements.
+2
Variable Table
Name
Data type
A
BYTE
B
BYTE
Variable Table
Name
Data type
A
BOOL
B
ARRAY[1..5]OF BOOL
C
ARRAY[0..18]OF BOOL

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Nx-csg series

Table of Contents