
6. The SPEL+ Language
6.7.4 Global variables
Global variables can be shared between all functions in a project. The Global instruction is
used to declare a global variable.
To declare global variables in a program, use the Global instruction with the desired
variable type (Boolean, Byte, Integer, Long, Real, Double, String) at the beginning of the
program before any Function statements:
One way to indicate that variables are global is to precede the name with "g_", as shown in
the example below.
Program: MAIN.PRG
Global Integer g_TotalCycles
Function main
Call LoadPart
...
...
Fend
Program: LOADPART.PRG
Function LoadPart
Jump pick
On gripper
Wait .1
Jump place
Off gripper
Wait .1
g_TotalCycles = g_TotalCycles + 1
Fend
For more information, see Data Types.
6.7.5 Global Preserve variables
You can preserve global variable values by using the optional Preserve parameter when
you declare global variables.
Preserved variables are stored in the controller’s SRAM.
If the data type of a preserved variable is changed, or the number of dimensions is changed,
then the variable values will be cleared.
EPSON RC+ 5.0 (Ver.5.4) User's Guide Rev.4 155
Kommentare zu diesen Handbüchern