ID : 5235
Global Variable
The name of a global variable is expressed with an alphabet letter(s) (I, F, D, S, V, P, J, T, IO) that expresses the type and an integer expression. Only an I/O variable has two letters (IO).
For example, F0001, F1, and F[1] all express the same floating-point variable of type real.
Since names of global variables are reserved by the system, they can be used without declaration.
Available Variable Types for Gloval Variable
The following types can be used as global variables.
- Type I: Integer variable (range: -2147483648 to + 2147483647)
Example) I0001, I1, I[1] - Type F: Floating-point variable of type real (-3.402823E + 38 to 3.402823E + 38)
Example) F0001, F1, F[1] - Type D: Double-precision variable of type real (-1.79769313486231D + 308 to 1.79769313486231D + 308)
Example) D0001, D1, D[1] - Type S: String variable (maximum of 243 characters)
Example) S0001, S1, S[1] - Type V: Vector variable (X, Y, Z)
Example) V0001, V1, V[1 - Type P: Position variable (X, Y, Z, RX, RY, RZ, FIG)
Example) P0001, P1, P[1] - Type J: Joint variable (J1, J2, J3, J4, J5, J6) (6 axes) (J1,J2,J3,J4) (4 axes)
Example) J0001, J1, J[1] - Type T: Homogeneous transform variable (X, Y, Z, Ox, Oy, Oz, Ax, Ay, Az, FIG)
Example) T0001, T1, T[1] - Type IO: I/O variable Example)
IO0001, IO1, IO[1]
Designation of Global Variable
A global variable is designated as described below.
The number of each variable is set in the project setting in advance
To designate a global variable number, put the number between square brackets "[ ]." Expressions can also be designated between "[ ]." For a value, "[ ]" can be omitted.
The following sample descriptions indicate "F[25]."
F25
F0025
F[25]
F[5*5]
I3=5 F[5*I3]
Precautions for Use
When overwriting global variables by multiple tasks, processing results may be different depending on the task execution timing.
For example, if I[0] is overwritten by another task while executing increment processing of "I [0]=I[0]+1", the processing result may not be "I [0]=0 ->1 -> 2" depending on the processing timing.
ID : 5235