|
Section 7: Simple Programming111
|
|
The HP-41C makes labeling programs easy. (Later, you will see how the calculator
actually prompts you for the label characters.) While you are keying in an
ALPHA label, the calculator ignores improper characters (e.g., , . : )
and does not accept any more than seven characters. The HP-41C does not accept
any more than two digits in a numeric label.
|
|
Here are some examples of proper and improper program labels:
|
|
|
Proper ALPHA
|
|
Proper Numeric
|
|
|
TRIG01
|
|
00
|
|
GO
|
|
83
|
|
A (Used as a local label.)
|
|
06
|
|
|
Improper ALPHA
|
|
Improper Numeric
|
|
|
RUN. (Illegal period in name.)
|
|
1 (Too few digits.)
|
|
COMPUTER. (Too many
characters.)
|
|
382 (Too many digits.)
|
|
|
Label Usage. Following are some considerations that you may find
helpful in labeling your programs.
|
|
-
Numeric labels can be used any number of
times, even in the same program.
-
If you label and execute a program with
the same name used by the HP-41C for one of the HP-41C standard functions
(e.g., DEG , ABS , etc.)
the calculator will first search program memory for the program name. If it
is found, the HP-41C will execute the named program. If the name is
not found as a label in program memory, the HP-41C will then execute the
standard HP-41C function having the same name.
|
|
The Complete Program
|
|
The complete program to solve for the area of a circle (one end of our
cylindrical water heater) given its radius is now:
|
|
g
LBL
ALPHA
CIRCLE
ALPHA
|
|
Assigns the name (CIRCLE) to and defines beginning of the program.
|
|
g
X2
|
|
Squares the radius.
|
|
g
|
|
Summons pi.
|
|
×
|
|
Multiplies r2 and π to give the area of the circle.
|
|
END
|
|
Defines end of program space in memory and stops the program (more about
END later).
|
|