6-43
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-3 Variables
6
6-3-6 Derivative Data Types
Restrictions in Specifying Member Offsets
The following restrictions apply to setting member offsets. If you specify member offsets for a struc-
ture, the same restrictions apply to structures that are members of that structure.
• If you set the memory offset type to User for a structure, you must set offsets for all members of
the structure.
• You cannot set initial values for members of structures for which offsets are set. The default initial
value for each data type is used. Refer to When the Initial Value Specification Is Left Blank on
page 6-59.
• The memory size that is required for the structure is determined by the sizes of the members, the
alignment values of the data types, and the memory configuration.
Errors in Specifying Member Offsets
The following error can occur when setting member offsets.
Instructions That Take a Structure as a Parameter
Some instructions pass structure variables as parameters. To do so, specify the structure variable as
the input parameter.
Example: Passing a Member of a Structure Variable to the MOVE Instruction and Passing a Struc-
ture Variable to the MOVE Instruction
Classification Data type Byte offsets Bit offsets
Boolean BOOL Can be set. Can be set.
Bit strings BYTE, WORD, DWORD, LWORD Can be set. Fixed.
Integers SINT, INT, DINT, LINT, USINT, UINT,
UDINT, ULINT
Can be set. Fixed.
Real numbers REAL, LREAL Can be set. Fixed.
Durations TIME Can be set. Fixed.
Dates DATE Can be set. Fixed.
Times of day TIME_OF_DAY Can be set. Fixed.
Dates and Times DATE_AND_TIME Can be set. Fixed.
Text strings STRING Can be set. Fixed.
Arrays Can be set. Can be set only for
BOOL elements.
Structures Can be set. Fixed.
Unions Can be set. Fixed.
Enumerations Can be set. Fixed.
POU instances Fixed. Fixed.
Error name Meaning Offset type Correction
Offset Out of Range Error A value that is out of range was
specified for an offset.
User Change the value of the
offset to a suitable
value.
Offset Not Set Error There is a member for which
the offsets are not set.
User Set offsets for all mem-
bers.
Memory Configuration
Overlap Error
The same memory location is
allocated to more than one
member.
User Change the values of
the offsets to suitable
values.
Initial Value Setting Error An initial value was set for a
structure member for which an
offset was specified when cre-
ating the variable table.
CJ or User Do not set an initial
value.