114 Section 8: Programming Basics
File name: hp 12c pt_user's guide_English_HDPMF123E27 Page: 114 of 275
Printed Date: 2005/8/1
Dimension: 14.8 cm x 21 cm
Setting the Calculator to a Particular Program Line
There will be occasions when you’ll want to set the calculator directly to a
particular program line — such as when you’re storing a second program in
program memory or when you’re modifying an existing program. Although you
can set the calculator to any line by using
Ç
as described above, you can do so
more quickly as follows:
z
With the calculator in Program mode, pressing
gi.
followed by three
digit keys sets the calculator to the program line specified by the digit keys,
and then displays that line number and the keycode of the instruction stored
there.
z
With the calculator in Run mode, pressing
gi
followed by three digit
keys sets the calculator to the program line specified by the digit keys. Since
the calculator is not in Program mode, the line number and keycode are not
displayed.
The decimal point is not necessary if the calculator is in Run mode, but it
is
necessary if the calculator is in Program mode.
For example, assuming the calculator is still in Program mode, you can set it to
program line 000 as follows:
Keystrokes Display
gi.
000
000,
Program line 000
Executing a Program One Line at a Time
Pressing
Ç
repeatedly with the calculator in Program mode (as described earlier)
enables you to verify that the program you have
stored
is identical to the program
you
wrote
— that is, to verify that you have keyed the instructions in correctly.
However, this does not ensure that the program you
wrote
calculates the desired
results correctly: even programs created by the most experienced programmers
often do not work correctly when they are first written.
To help you verify that your program works correctly, you can execute the program
one line at a time, using the
Ç
key. Pressing
Ç
while the calculator is in Run
mode advances the calculator to the next line in program memory, then displays
that line’s number and the keycode of the instruction stored there, just as in
Program mode. In
Run
mode, however, when the
Ç
key is released the
instruction in the program line just displayed is executed and the display then
shows the result of executing that line.
For example, to execute the program stored in the calculator one line at a time: