Baldor mn1854 manual Gosub Syntax GSi and GSname, =1-400, name = any legal program name

Models: mn1854

1 105
Download 105 pages 58.42 Kb
Page 67
Image 67

GS

Gosub

syntax – GSi and GS[name]

 

Value:

N/A

 

Units:

N/A

 

Range:

i=1–400, [name] = any legal program name

Jumps to program number or name and returns to the calling program when command processing reaches the EN command in the sub–routine. After the return, execution continues at the command immediately following the GS statement. Subroutines may be nested 16 levels deep. A Goto (GT) clears the subroutine stack, preventing future Gosubs from overflowing the stack or returning to the wrong location.

Example:

 

 

DI10 GS[Part A] GO

Run program “Part A”, return and make a 10 unit incremental move.

GT

Go to Program

syntax – GTi or GT[name]

 

Value:

N/A

 

 

Units:

N/A

 

 

Range:

i=1–199 (1–400 with 30k memory option), [name] = any legal program name

GT branches to the program number or name specified. All subsequent commands in the calling program are ignored. Nested loops and subroutine calls are cleared by a GT command.

Examples:

 

IF10 GT[PART A] EB

IF input 1 is on and input 2 is off, jump to program “Part A”

IF01 GT20 GT30 EB EN

IF input 1 is off and input 2 is on, run program 20. Program 30 is never run.

 

Use the GS command if you want to return to this program and goto

 

program 30.

6-12 Keypad Programming

MN1854

Page 67
Image 67
Baldor mn1854 Gosub Syntax GSi and GSname, =1-400, name = any legal program name, IF10 Gtpart a EB, IF01 GT20 GT30 EB EN