ID : 5035
Static Attribute
Static attribute is an attribute that retains a local variable area in "Variable Memory" that retains the value even if the controller is turned off.
It declares a variable using declaration statement "Static" in a task. And, static attribute will be added automatically to a local variable declared by "Public."
Existence or non-existence of Static attribute does not influence valid range.
Data Type
Data type of local variable that Static attribute can be applicable are as follows.
- Integer type
- Single precision real number type
- Double precision real number type
- Vector type
- Position type
- Joint type
- Homogeneous translation type
- String type (data size is up to 255 bytes)
I/O type cannot be used for declaration.
Memory Used
Memory area is assigned in "Variable Memory" when a Static (attribute) local variable is created. In case of global variable, it is also assigned in variable memory. Assign a proper number for each of them not to exceed maximum memory size. Refer to "Display/Setting of the Number of Variables Used."
Creation and Deletion of Static Local Variable
Static local variable will be created (initialized) when a program file is compiled. However, if the program has already been compiled previously, and if there is no modification of description in Static local variable, it will not be initialized to keep the value. Even if there is one description modification in Static local variable, all the Static local variables in the program will be initialized.
The timing of deletion of Static local variable is when you delete the description of Static local variable in the program code and compile it, or when you delete the program file.
Related Terms
ID : 5035