beautypg.com

Chapter 6: branch & loop programs – Victor Technology V12 User Manual

Page 63

background image

V I C T O R T E C H N O L O G Y

63

Chapter 6: Branch & Loop Programs

Program instructions typically execute sequentially through program line
numbers, but it is possible to transfer or ‘branch’ to a program line that is not
the next line of program memory.
Using the GTO instruction in a program will transfer an execution to any
program line by using the designated three digit code of that line within the

GTO command. After a branch, execution will resume sequentially as normal.

For example, if program line 008 contains the command r GTO 004, then
program line 004 will be executed after program line 008.

When the GTO instruction describes a lower number program line, the
instructions contained within the lines between that line and the GTO instruction
will be performed repeatedly. This is called ‘looping’.

To terminate the execution of a loop, insert a r xinstruction within the loop. Also, touching any key while executing the loop will
stop the program.

Branching with Conditions
Sometimes you will need to branch to different lines of program memory,
conditionally. There are two conditional test instructions used in program of
conditional branching.

r x

the value in the y-register. The x-register holds the number currently displayed
in run mode and the y-register holds the number in the display when you
touched ENTER. (Touching 3 ENTER 9 would store 3 in the y-register and 9 in
the x-register.)

r x=0 determines whether the value in the X register is equal to 0.


Using these instructions will either: