6 Programming
6-60
NJ-series CPU Unit Software User’s Manual (W501)
• Variables with AT specifications (retained areas or DM, Holding, or EM Area specifications only)
Precautions for Correct UsePrecautions for Correct Use
If the CPU Unit has no Battery, the above variables are also initialized.
If you specify the Constant attribute, the value of the variable cannot be written by any instructions, ST
operators, or CIP message communications. Setting the Constant attribute will prevent any program
from overwriting the variable. The values of variables with a Constant attribute cannot be written from
instructions after the initial value is set. If there is an instruction in a POU that attempts to write a value
to a variable with the Constant attribute, an error will occur when the user program is compiled.
Operation
If there is an instruction or operator in a POU that attempts to write a value to a variable with the
Constant attribute, the following operations will occur.
Range for Constant Attribute Specification
The Constant attribute is specified separately for each variable. Set them for all elements and mem-
bers of array, structure, and union variables.
You cannot write to variables with the Constant attribute from the user program.
The Network Publish attribute allows a variable to be read/written from external devices (other Control-
lers, host computers, etc.) through CIP message communications or tag data links. If this attribute is not
set, you can read/write the variable from the Controller that declared the variable and external devices
(other Controllers, host computers, etc.) cannot read/write that variable.
Variables that have been published to the network are called network variables.
Constant
Source Operation for attempts to write the value
User program
An error is detected during the program check. The Sysmac
Studio checks the program when it is built. A building error
occurs at that time.
Communications
Writing from Sys-
mac Studio
Not supported.
CIP messages A command error occurs.
Tag data links
An error occurs when a tag data link starts. The tag data link will
continue to operate. However, the values of variables with the
Constant attribute are not written.
Input refreshing from slaves and Units An error does not occur and the value is written.
Forced refreshing
Network Publish