Omron CJ1W-EIP21 Operation Manuals page 386

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

Advertisement

Appendices
Precautions for Correct Use
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 allocated (including unused bits).
Variable A
First byte
First byte + 1
Variable B
First byte + 2
First byte + 3
Variable C
First byte + 4
First byte + 5
First byte + 6
First byte + 7
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.
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
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
A-12
Memory
Bytes
Two bytes are allocated.
Two bytes are allocated
for 5 elements.
Four bytes are allocated
for 19 elements.
Number of
elements − 1
+2
16
Truncate the decimal portion of the result
of the calculation in brackets.
Memory
Bytes
Variable A, 1 byte
Variable B, 1 byte
Memory
Bytes
First byte
First byte + 1
First byte + 2
First byte + 3
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
Variable Table
Name
A
B
C
Variable Table
Name
Data type
A
BYTE
B
BYTE
Variable Table
Name
Data type
A
BOOL
Variable A, 2 bytes
B
BOOL
Variable B, 2 bytes
Data type
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL

Advertisement

Table of Contents
loading

Table of Contents