Convenient Program Commands - LEXIBOOK GC500i Instruction Manual

Graphic calculator
Table of Contents

Advertisement

GB

4.7 CONVENIENT PROGRAM COMMANDS

The programs for this unit are made based upon manual calculations. Special program commands, however, are avai-
lable to allow the selection of the formula, and repetitive execution of the same formula.
Here, some of these commands will be used to produce more convenient programs.
4.7.1 Jump commands
Jump commands are used to change the flow of program execution.
Programs are executed in the order that they are input (from the lowest step number first) until the end
of the program is reached. This system is not very convenient when there are repeat calculations to be
performed or when it is desirable to transfer execution to another formula. It is in these cases, however, that
the jump commands are very effective. There are three types of jump commands: a simple unconditional
jump to a branch destination, conditional jumps that decide the branch destination by whether a certain
condition is true or not, and count jumps the increase or decrease a specific memory by one and then
decide the branch destination after checking whether the value stored equals zero or not.
4.7.2 Unconditional jump
The unconditional jump is composed of "Goto" and "Lbl". When program execution reaches the statement
"Goto n" (where n is number from 0 through 9), execution then jumps to "Lbl n" (n is the same value as
Goto n). The unconditional jump is often used in simple programs to return execution to the beginning for
repetitive calculations, or to repeat calculations from a point within a program. Unconditional jumps are
also used in combination with conditional and count jumps.
Example: The previously presented program to find the surface area and volume of a regular tetra-
hedron will be rewritten using "Goto 1" and "Lbl 1" to allow repeat calculations.
?, →, A, :, √, 3, x, A, x
√, 2, ÷, 1, 2, x, A, x
*** Hereinafter, commas (,) will be used to separate steps for the sake of clarity.
Add "Goto 1" to the end of the program, and add "Lbl 1" to the beginning of the program as the branch
destination.
If this is simply left the way it is, however, the volume will not be displayed and execution will move
immediately to the input of one side at the beginning. To prevent this situation, insert a display command
(
) in front of the "Goto1".
The complete program with the unconditional jump added should look like this:
Lbl, 1, :, ?, →, A,: , √, 3, x, A, x
√, 2, ÷, 1, 2, x, A, x
Now let's try executing this program.
*** Henceforth, the displays will only show calculation result output.
Prog
0
10
EXE
EXE
EXE
7.5
EXE
EXE
EXE
Since the program is in an endless loop, it will continue execution. To terminate execution,
press
MODE
MODE
- 56 -
,
,
2
, 3
y
,
,
2
, 3,
, Goto, 1
y
EXE
?
173.2050808
117.8511302
?
97.42785793
49.71844555
?
.
1
_
1
19 steps
25 steps
Stored in P0. The length of
the side =10
The length of the side =7.5
Copyright L
2002
EXIBOOK

Advertisement

Table of Contents
loading

This manual is also suitable for:

Gc1000i

Table of Contents