Declaration of user variables
A user variable is, as its name suggests, a variable created by the user. The user variables can then be used in the various part-programs or linked to physical or PROFINET inputs/outputs.
All created variables are global to the entire platform. This means that each variable can be used in any part-program.
There are 6 variable formats, these formats are described below:
Name |
Format |
Coded on ... [bits] |
Min and Max value |
---|---|---|---|
Floating point number type LONG |
LREAL |
64 [bits] floating |
-1.797_693_134_862_315_8E+308 to -2.225_073_858_507_201_4E-308, 0.0, +2.225_073_858_507_201_4E-308 to +1.797_693_134_862_315_8E+308 |
Floating point number |
REAL |
32 [bits] floating |
3.402_823_466E+38 to -1.175_494_351E-38, 0.0, +1.175_494_351E-38 to +3.402_823_466E+38 |
Double integer |
DINT |
32 [bits] |
-2147483648 to 2147483647 |
Integer |
INT |
16 [bits] |
-32769 to 32767 |
Bit |
BOOL |
1 [bit] |
0 or 1 |
Time |
TIME |
32 [bits] |
-2147483648 to 2147483647 |
The value contained in a Time variable represents a time in [ms]. Example: If a TIME variable contains the value 75, when passing from this variable to the press in a part-program, the press will understand 75[ms]. |
There are 15 other variable formats, these formats are specific to some instructions.
There are also tables of 20 variables of type REAL, LREAL and DINT used by the instruction "Recording values in a table".
Declaration of a variable
To declare a variable, in the project tree of the MecaMotion, double-click on the "Variables" tab. The window of figure 1 opens.
Figure 1: Variable declaration window
It is in this window that the different variables used in part-programs are declared.
To declare a variable:
•The first thing to do is to fill in the name of the variable, it is by this name that the variable will be called in the different part programs.
•When you have entered the name of the variable, you must choose the variable format by opening the "Types" drop-down menu.
•As soon as the variable format is defined, the "N°" and "Address" fields will be automatically filled in.
Figure 2: Declaration of a variable
Each variable can be declared as retain, this allows the value of the variable to be kept in memory when the press is switched off.
Figure 3: Declaration a retain variable