EasyManua.ls Logo

Omron NJ Series - Page 619

Omron NJ Series
668 pages
Print Icon
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...
Appendices
A-92
NJ-series CPU Unit Software User’s Manual (W501)
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
Variables with Four-byte Alignments (e.g., DWORD)
Four bytes of memory are allocated for the four-byte alignment.
The location of the first byte of data in memory is an integer multiple of four bytes. Therefore, if a
variable with a two-byte alignment, such as WORD data, is inserted, two bytes of unused memory
will remain.
Example: Consecutive variables in the following order: DWORD, WORD, and DWORD
Basic Data Types
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)
Variable Table
Name
A
B
C
Data type
DWORD
WORD
DWORD
Variable A,
4 bytes
Variable B,
2 bytes
Variable C,
4 bytes
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
First byte + 8
First byte + 9
First byte + 10
First byte + 11
Not used.
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 4)
First byte +
(integer multiple of 4)

Table of Contents

Other manuals for Omron NJ Series

Related product manuals