Omron SYSMAC CJ Operation Manual page 180

Sysmac cj-series programmable controller motion control unit
Hide thumbs Also See for SYSMAC CJ:
Table of Contents

Advertisement

All BASIC commands
4-2-123 GLOBAL
4-2-124 GOSUB..RETURN
168
/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 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
LIST_GLOBAL
/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

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cj1w-mch72

Table of Contents