Appendices
A-12
CJ-series EtherNet/IP Units Operation Manual for NJ-series CPU Unit (W495)
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).
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.
Specific examples of the rules for memory allocation for variables of each data type are given below.
Variables with One-Byte Alignments (e.g., BYTE)
One byte of memory is allocated for the one-byte alignment.
Example: Two consecutive BYTE variables
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
Basic Data Types
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.
Amount of memory = 2
Truncate the decimal portion of the result
of the calculation in brackets.
Number of
elements − 1
16
+2
Variable A, 1 byte
Variable B, 1 byte
Variable Table
Name
A
B
Data type
BYTE
BYTE
Bytes
Memory
First byte
First byte + 1
Variable Table
Name
A
B
Data type
BOOL
BOOL
Bytes
Memory
First byte
First byte + 1
First byte + 2
First byte + 3
Variable A, 2 bytes
Variable B, 2 bytes
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
Summary of Contents for SYSMAC CJ1W-EIP21
Page 8: ...Manual Structure 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 42: ...Revision History 40 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 68: ...1 Introduction 1 26 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 266: ...9 FTP Server 9 20 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495...
Page 431: ...Index 1 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 I Index...
Page 436: ...Index 6 CJ series EtherNet IP Units Operation Manual for NJ series CPU Unit W495 Index...
Page 437: ......