Omron trajexia CJ1W-MCH72 Operation Manual page 180

Sysmac cj-series programmable controller
Hide thumbs Also See for trajexia CJ1W-MCH72:
Table of Contents

Advertisement

All BASIC commands
4-2-125 GLOBAL
4-2-126 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.
When the GLOBAL is declared, the declaration remains active until the
next CJ1W-MCH72 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 GLOBALs 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
N/A
/i
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.
Section 4-2
169

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents