
BASIC commands
PROGRAMMING MANUAL
89
Revi
si
on 3.0
3.2.134 GLOBAL
/i
3.2.135 GOSUB..RETURN
/i
3.2.136 GOTO
/i
Type
System command
Syntax
GLOBAL "name", vr_number
Description
Declares the name as a reference to one of the global VR varia-
bles. The name can then be used both within the program contain-
ing the
GLOBAL
definition and all other programs in the Trajexia
Tools 2 project.
Note: The program containing the
GLOBAL
definition must be run
before the name is used in other programs. In addition, only that
program 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 TJ1-MC__ 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
meaning 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, numeri-
cal 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
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 execution 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 compi-
lation error before execution.
Labels can be character strings of any length, but only the first 15 charac-
ters are significant.
Example
main:
GOSUB routine
GOTO main
routine:
PRINT "Measured position=";MPOS;CHR(13);
RETURN
See also
GOTO
Type
Program control command
Syntax
GOTO label
Description
The
GOTO
structure enables a jump of program execution.
GOTO
jumps pro-
gram execution to the line of the program containing the label.
I52E-EN-03.book Seite 89 Freitag, 29. Juni 2007 11:55 11