![background image](http://html1.mh-extra.com/html/omron/sysmac-cj-series/sysmac-cj-series_operation-manual_743585180.webp)
All BASIC commands
Section 4-2
168
4-2-123 GLOBAL
/i
4-2-124 GOSUB..RETURN
/i
Type
System command
Syntax
GLOBAL "name", vr_number
Description
Declares the name as a reference to one of the global VR variables.
The name can then be used both within the program containing the
GLOBAL
definition and all other programs in the Trajexia Studio solu-
tion.
Note: The program containing the
GLOBAL
definition must be run
before the name is used in other programs. In addition, only that pro-
gram should be running at the time the GLOBAL is executed, otherwise
the program error will appear and the program will stop when trying to
execute this command. For fast startup the program should also be the
only process running at power-up.
Using
GLOBAL
with only the name will erase the specified constant.
Using
GLOBAL
with no parameters will erase all
GLOBAL
declara-
tions. This also happens when the CJ1W-MCH72 is reset by switching
the power off and back on, or by executing the
EX
command.
In programs that use the defined
GLOBAL
,
name
has the same mean-
ing as
VR(vr_number)
. Do not use the syntax:
VR(name)
.
A maximum of 128
GLOBAL
s can be declared.
Arguments
•
name
Any user-defined name containing lower case alpha, numerical or
underscore characters.
•
vr_number
The number of the VR to be associated with
name
.
Example
GLOBAL "srew_pitch",12
GLOBAL "ratio1",534
ratio1 = 3.56
screw_pitch = 23.0
PRINT screw_pitch, ratio1
See also
LIST_GLOBAL
Type
Program control command
Syntax
GOSUB label
...
RETURN
Description
The
GOSUB
structure enables a subroutine jump.
GOSUB
stores the
position of the line after the
GOSUB
command and then jumps to the
specified label. Upon reaching the
RETURN
statement, program execu-
tion is returned to the stored position.
Note: Subroutines on each task can be nested up to 8 levels deep.
Arguments
•
label
A valid label that occurs in the program. An invalid label will give a
compilation error before execution.
Labels can be character strings of any length, but only the first 15
characters are significant. Alternatively line numbers may be used
as labels.
Содержание SYSMAC CJ Series
Страница 2: ......
Страница 70: ...Specifications Section 2 4 58...
Страница 84: ...FINS commands Section 3 4 72...
Страница 148: ...All BASIC commands Section 4 2 136 AXIS 1 AXIS 0...
Страница 277: ...Section 265 SECTION 5 Examples This chapter gives 2 categories of examples and tips How to s Practical examples...
Страница 370: ...Section 358...