HP41C
HP41C
/( 1'
CLST
When Messrs. Hewlett and Packard founded our company in 1939, we offered one superior
product, an audio oscillator. Today, we offer over 3500 quality products, designed and built
for sorne of the world's most discerning customers.
Since we introduced our first scientific calculator in 1967, we've sold millions worldwide,
both pocket and desktop models. Their owners include Nobel laureates, astronauts, moun-
tain climbers, businessmen, doctors, students, and housewives.
Each of our calculators is precision crafted and designed to solve the problems its owner
can expect to encounter throughout a working lifetime.
HP calculators fill real needs. And they provide lasting value.
'
F//~ HEWLETT
~~ PACKARO
Owner's Handbook
and
Programming Guide
September 1980
00041 -9031 3
Section 2: Display Control .. .. ...... . ... . ... . .. .... . .. . ... . ... . .. '. ... . 31
Display Format Control .... . .. . . .. ........ . .... . . . ............. . . 31
Automatic Display Switching and Scrolling ............. . ........... 35
Annunciators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Section 3: The Automatic Memory Stack and ALPHA Register . . ... . ..... . 39
The Automatic Memory Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
The Display and ALPHA Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Manipulating Stack Contents ... . ... .. .... . ........... . ........... 44
The 1ENTER1 Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Clearing the Stack ..... . .. .. .. . . . ... .. ........... .. .......... . .. 47
One-number Functions and the Stack ..... . ........ ... . .. .. .. .... 47
Two-number Functions and the Stack ............ . ....... . ....... . 48
Chain Calculations .......................... . ...... .... ......... 49
Order of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
LAST X ....................................... .. ............. . . 52
Constant Arithmetic ............................................. 53
2
Contents 3
Section 5: Storing and Recalling Numbers and ALPHA Strings .... . ..... .. 67
Primary Storage Registers ...................................... . . . 68
VI EW Function .................. . ....................... .... ..... 72
Defining Storage Register Configurations .. .. . . ........... . ....... . .. 73
Clearing Storage Registers . ... .... .. ........ . ... . ... . ... . ... . ...... 73
Storage Register Arithmetic ....... ... .............................. 74
Storage Register Overflow ..... . ........................ . . ..... . . .. 75
lnsert application modules and peripherals beginning with the highest-numbered available port.
HP-41CV Only: Does not use memory modules. Insert application modules and peripherals in
any available port.
CAUTION
Always turn the calculator off before inserting or removing plug-in modules
or peripherals. Failure to do so could damage both the calculator and the
module or peripheral.
Sa
HP-41C/ 41 CV Memory
1 1T Standard in
1 1z
}
the Extended data storage registers
C:=J v HP-41CV; (addressed indirectly).
1 1X requires
optional
.___ _.I LAST X memory
modules or
ALPHA Register quad memory
module in
1 (24 characters maximum)I
The HP-41 C.
R,,
R,
Primary data storage registers.
Statistics registers. Location R,. Initial allocation is R00 through
defina ble using 1I REG 1. L&J R J6 to data storage registers.
Can be changed with the 1SIZE 1
1 R.,
function.
R,,
R,,,
-
1useA1, 1-1 , and 1Al.PHA 1. Ali other key ASN
locations, including shifted key locations,
can be reassigned. Any function in any of the
catalogs can be reassigned. This includes pro-
grams with ALPHA labels that you store into
program memory . To assign a function or
program to a~:
l. Press l:!!!!.I .
2. Press 1Al.PHA 1 and the program or function
name to be assigned to a key. Press
1Al.PHA 1 again.
3. Press the key, or and the key which
is being reassigned.
4 . The key becomes active with the re-
a ssigned function while the calculator is
in USER mode.
To reassign a key back to its normal mode
fun ction, press - ~ 1Al.PHA11Al.PHA 1 and
the key (or and the key).
If a key in the top two rows (and shifted top row) is not reassigned , special local label searching is performed
in USER mode. When the key is pressed the calculator searches for the local labels that correspond to the ALPHA
characteron the key (LBLA through LBLJ and LBL a through LBLe) . Ifthe !abe! is found in thecurrent program,
execution begins there. lf the !abe! is not found in the curren! program , the normal mode function of the key is
executed. In USER, normal and PRGM modes, the top row ofkeys corresponds to the numbers 01 through 05 and
the second row corresponds to the numbers 06 through 10 (from left to right) . The number/key correspondence is
effective only when a function is executed or keyed in that expects a one or two-digit parameter or address. For
example, pressing (!!Q)~ is the same as pressing(!!Q) 05 . Only the right-most digit is used when a single-digit
parameter is expected.
6
ALPHA Keyboard
a b e d e
IAl'PEHDI is used for add ing to or editing
ALPHA strings. lf ALPHA entry has been
terminated, IAl'PEHDI puts back the prompt so
you can add to the ALPHA reg ister.
BST
Shift key pressed before another key specifies ----1--a.-1-11~
a shifte d ALPHA character or function
(shown here above the keys). To get the char-
CLA
acter shown here on the face of the key,
simply press that key.
7 8
1ASTO1 stores the left-most six characters in the
ALPHA reg ister into the indicated data
storage register.
a 4 5
register and adds it to whatever is already in 2 3
*
the ALPHA register.
11
~ clears the display and ALPHA register.
Sa
Normal Mode Keyboard
Pfme
ISG
11111111
RTN CLX/A
-
X<)?
'? SF
BEEP
CF
P+ R R P
FIX SCI ENG
grarn labels during the listing of catalog 1.
Catalog 2 lisis ali functions contained in cur-
rently plugged-in application modules and
peripherals. Catalog 3 lists ali standard
HP-41 C functions. Press any key (other than
~ or (!!!)) to slow the listing down . Press
~ and any other key 10 terminate a running
listing. Press ~ 10 stop the listing (use
(!!!) and [!ID to step through the catalog
manually).
6b
Introducing the HP-41 C and HP-41 CV
The Philosophy of the HP-41 C/41 CV Systems
The HP-41 C and HP-41 CV calculators representa totally new concept in the design
of Hewlett-Packard calculators. In fact, beca use of their advanced capabilities, these
calculators can even be called personal computing systems.
With so many different kinds of calculator users and applications in the world, we at
Hewlett-Packard decided we could provide a significant contribution by designing
and building quality calculators with expandable and flexible capabilities. The
alphanumeric HP-41 C and HP-41 CV calculators are the results of that decision.
The H P-41 C and the H P-41 CV are identical except for initial memory size. The
basic HP-41 C's four module ports allow you to use applications modules,
peripherals, and memory modules in any combination. (By using one HP 82170A
Quad Memory Module or up to four HP 82106A Memory Modules, you can even
expand the basic HP-41C memory to equal that of the HP-41CV.) The HP-41CV's
full-sized interna! memory al!ows you the resident memory you need while still
providing room for up to four plug-in accessories. On either calculator you can
specify which functions are active on the keyboard and how they are positioned. As
you can see, the HP-41 C and HP-41CV calculators provide you with true computing
systems- ones that can even interface with other devices.
The HP-41 C and HP-41 CV ha ve a great number of functions. At first you will not
need to learn how every function works; just be aware that they are there. A part of
the design philosophy was to provide a healthy number of functions and !et you
choose what you need . As your programming and calculating needs expand, you will
use more of the functions provided. If you need a function that is not on your
calculator, chances are that you can write a program to fil! that special need. Those
special programs, along with programs you write, can be assigned by name to the
keyboard for execution just like any of the standard functions.
Aside from the advanced computer-like capabilities of the HP-41C and HP-41CV,
possibly the most attractive feature is their ability to solve problems easily.
Experience or knowledge of complicated programming languages is not required.
An HP-41 C or HP-41 CV represents part of an extremely capable personal
computing system. At the same time, both calculators are very friendly, so take sorne
time to work carefully through this handbook. You will be surprised at how easily
and quickly you will learn to take advantage of the power of your new calculator.
Note: The HP-41 C and HP-41 CV differ only in their initial Continuous
Memory capacities. The term " HP-41 C" is used throughout the rest of this
handbook, unless otherwise specified, to refer to both calculators.
7
8 lntroducing the HP-41 C and HP-41 CV
Sample Problems
The HP-41C di splay cont ai ns seven "annunciators" or key words that te ll you the status of
the calculator.
Press the ~ key now and check to see if the USER annunciator in the di splay is on . lf the
USER annunciator is di splayed, press the luseR I key (locatedjust below the display) to tum
the USER annunciator off.
lf the BAT (battery) annunciator is displayed, or your HP-41 C does not ha ve the batteries
installed, refer to Batteries, page 240.
To get the fee l of your new calculator try a few simple calculations . Press (I!I) 4 now so
your di splay will match the displays in the following proble ms.
Now let's look ata sample problem to see how the HP-4 1C is used to solve the problem
manually and then automaticall y using a prog ra m.
Most conventional home wate r heaters are cylindri-
cal in shape, and you can easi ly calculate the heat
loss from such a water heater. The form ula q =hAT
can be used , where
For our example let' s assu me you have a 52-gallon cylindrical water heater and you wish to
determine how much energy is being lost because of poor insulation . In initial measure-
ments, you found an average temperature difference between the heater surface and
surrounding air of 15 degrees Fahrenheit. The surface area of the tank is 30 square feet and
the heat transfer coefficient is approximately 0.47 .
lntroducing the HP-41 C and HP-41 CV 9
To cale u late the heat loss of the water heater, merely press the following keys in order.
Keystrokes Display
15IENTER I 15.0000 Temperature differe nce.
30 30 _ Area of water heater (sq. ft.).
0 450.0000 lntermediate answer.
.47 .47_ Coefficient of heat transfer.
0 211 .5000 Heat loss in Btu per hour.
Writing the Program. You have already written it! The program is the same series of
keystrokes you executed to solve the problem manually . One addi tional instructi on , a
/abe/, is used to define the beginning of the program.
Loading the Program. To load the instructions of the program into the HP-4 1C:
Press the following keys in order. The di splay shows symbo ls or names representing each
instruction entered . The calculator records (remembers) the instructions as you enter them .
Keystrokes
IPRGMI Places the HP-41C into PRGM (program) mode . The
annunciator will show in the display to let you know that the
HP-4 1C is now in PRGM mode.
1Grol88 Thi s prepares the calculator for the program .
ILBL I
1 ALPHA 1 HEAT 1 ALPHA 1 Defines the beginning of the program and names it HEAT.
30
0
.47
0
} The sa me instructi ons you exec uted to solve the problem
manually.
1O lntroducing the HP-41 C and HP-41 CV
Running the Program. Press the fo llowing keys to run the " HEAT" program. Find the
heat loss of the water heater at temperature differences of 22 and 65 degrees Fahrenheit.
Keystrokes Display
i~GMI 211 .5000 Takes calculator out of PRGM
mode- turns PRGM annunciator
o ff. Result re mains from previous
example.
22 22- The first temperature d iffere nce.
1xEO 1 ( execute) XEQ __ Prompts Execute what? with
XEO -- .
1 ALPHA 1 HEAT 1 ALPHA 1 3 10.2000 Press the lette r keys to spell the
program na me . The program is
executed and the heat loss (Btu per
hour) is displayed.
65 65- The second temperature difference .
lxeol XEQ __ Execute what?
1 ALPHA 1 HEAT 1 ALPHA 1 916.5000 Btu per hour.
lcLxl 0.0000 Clear the display.
You can save even more time and keystrokes by assigning the program to a key o n the
keyboard ! Programs that you assign to keys are treated just like any other functions when
you place the HP-4 1C into a special .. USER" mode. The n you can exec ute your program
with the press o f a single key - without entering the prog ra m name each time ! Let's assign
the HEAT program to the ~ key now .
Keystrokes Display
. I ASNI ASN _ The HP-41C prompts Assign what.7
1 ALPHA 1 HEAT 1 ALPHA 1 ASN HEAT _ The prog ram name. The HP-41C is
now prompting you for the key
location.
0.0000 HEAT is now assigned to the ~
location.
Now run HEAT for te mperature differences of 38 F, 27 F and 45 F. To run HEAT. you
now press the l u SER 1 key, located just be low the display, to place the HP-41 C into USER
mode. Notice that the HP-41C le ts you kno w th at it is in USER mode by tuming on the
USER annunciator in the display .
lntroducing the HP-41 C and HP-41 CV 11
Keystrokes Display
luSERI 0.0000 Puts the calculator in USER mode
and tums on the USER annunc iator.
38 1HEAT 1 ((El) 535.8000 Since HEAT is ass igned to the (El
key in USER mode, you can run
HEAT quickly and simply as a
keyboard function .
Try hold ing the 1HEAT 1 ((El) key down brie fl y. Notice how the HP-41C re minds you that
HEAT is assigned to that key (i n USER mode) by showing the name HEAT in the di splay
whi le you press and hold 1he key . (Holding the key down longer than abou t a half second
nullifies the function .)
Keystrokes Display
271 HEAT 1 ((El) THEAT Press and ho ld the key for a moment
380.7000 to see the program name . When you
release the key, 1he function is exe-
cuted, g iving the answer in Btu per
hour.
45 IHEAT 1 634.5000 Btu per hour.
icLxl 0.0000 Clears the dis play .
iuSERI 0.0000 Takes the HP-41 C out of USER
mode .
Programming the HP-41C is that easy! The exc iting capabilities of the HP-4 1C together
with the ease of progra mming and execution make the HP-4 1C poss ibl y the mos t usable,
capable handheld calcul ator syste m you can ow n.
The Catalogs of Functions. The HP-4 1C has three separate catalogs of functions. You can
list the programs you have written; more than 130 residen! HP-41 C fu nctions; ali functions
contained in plug-in modules (more about modules in a minute) . There is never any doubt
as to what is resident in the calculator-all you have to do is list the catalogs.
Key Reassignments. Nearl y any function in the HP-41 C (functions you have written,
sta ndard HP-41 C functions, application module functions) can be assigned or reassigned
to most key or shifted key locations on the keyboard. This allows you to' ' personalize'' your
calculator, positioning functions on the keyboard where you want them.
HP-41C/41CV Memory and Extensions. The basic HP-41C comes with 63 data
storage registers or 63 registers of program memory (200-400 lines); the HP-41 CV
comes with 319 data storage registers or 319 registers of program memory (up to
2,000 lines). In both calculators you can define the combination of data storage
registers and registers of program memory that you desire (for example, the HP-41C
begins with a combination of 17 data storage registers and 46 program memory
registers and the H P-41 CV begins with a combination of 273 data storage registers
and 46 program memory registers). If your calculator is the HP-41C, you have the
option of increasing memory capacity by adding one to four additional HP 82106A
Memory Modules or one HP 82170A Quad Memory Module. Each HP 82106A
Memory Module contains 64 additional registers. The HP 82170A Quad Memory
Module contains 256 additional registers. You can increase the HP-41 C capacity to
that of the HP-41CV- a maximum of 319 registers of program memory or 319 data
storage registers, or any combina tion! (The HP-41CV does not use memory
modules.)
But that's not ali! The four input/ output receptacles (1/ O ports) in your calculator
allow you to plug in the additional technical application modules (application
"pacs"), an HP- 67 / 97-compatible card reader, a thermal printer, and an optical
wand.
CAUTION
Always turn the calculator off before inserting or removing any plug-in
extensions or accessories. Failure to do so could damage both the calculator
and the accessory.
Part 1
Using Your Calculator
Section 1
Getting Started
Yo ur basic HP-4 1C is s hipped full y eq uipped ; the batteries will be installed by you or your
dealer. lf you tum o n your HP-41 C and the BAT annuniciator in the display appears, or
batteries are not ins talled, refer to Batteries , page 240.
Operating Keys
loNI Key
To begi n, press @BJ . The@BJ key turns the HP-41 C power on and off. In order to conserve
battery power, the HP-4 1C w ill au tomatically tum itse lf off after JO minutes of inacti vity .
You can tum it o n again by simply press ing@Bl .
Each time the HP-4 1C is tumed on, it 'wakes up" in normal o r USER mode; whichever
was active when the calculato r was tumed off. lf you were in PRGM (program) o r ALPHA
(alphabetic) mode when the calculator turned off, when you tum it back on again, these
modes will not be acti ve.
Keystrokes Display
iuSER I Places calculato r in
0.0000 USER mode; your
USER
customized HP-41C
keyboard becomes
active . USER annun -
ciator tums o n .
Second press takes the
HP-41 C out of USER
mode; ali " normal"
functions on the
HP-4 1C keyboard
become active . Annun-
ciato r turns off.
15
16 Getting Started
When the HP-41C is in USER mode, ali keys that have not been reassigned reta in the ir
normal mode functions. (" Normal mode" means th at the calcul ator is not in PRG M ,
ALPH A or USER mode.) Normal mode func tions are the ones printed above and on the
faces of the keys.
1PRGM1 Mode Key
Whe n the calculator is in PRGM mode, keystrokes are recorded as prog ram instructions.
Programming and PRGM (mode) are covered in deta il in part 11 of th is handbook.
Display
lnitial Display
Should you see MEMORY LOST in the di splay the first time you tum the HP-41C on , do not
worry - it means that power to the continuous memory of the calculator has been inter-
rupted at sorne time . Mere ly press 8 (the correction key) to clear the error , then continue.
When power to continuous memory is interrupted, ali information you placed into the
HP-41 C is lost.
Whe never the HP-41 C is tumed on , the di splay shows the number or ALPH A charac te rs
that were in the di splay before you tumed the calculator off.
Display Capacity
The HP-41 C display has 12 ful! cha racter pos itions. You can put up to 24 characters in the
di splay. As you place a stri ng of ALPHA characters in the display that is larger th an 11
characters, the HP-41 C automat ically " scrolls " the characte rs off to the left (more about
thi s later). For example, place the calculator into ALPHA mode , and press the followi ng
keys:
Keystrokes Display
I ALPHA I Places the HP-41 C into ALPH A
mode a nd tums the ALPH A display
annunciator on .
ABCDEFGHIJK ABCDEFGHIJK _ The di splay now contains 11 full
characters.
L BCDEFGHIJKL _ Now 12 characters .
M CDEFGHIJKLM _ Now 13 characte rs .
i ALPHA J 0.0000 Takes the HP-41 C out of ALPHA
mode .
Getting Started 17
Keyboard
Each key on the keyboard can perform severa! different fun ctio ns. The particular functions
that are avai lable o n the keyboard depe nd on the status of the calculator. lf the HP-41C
is in "normal" mo de, th at is, not in PRGM , USER , o r ALPHA mode, the avai lable fun c-
tio ns a re the ones printed on the face of the key and abo ve the key .
You can always te ll whe n you have pressed the (shift ) key: a S HIFT annunc iator in
the dis play s hows each time you press . The a nnunc iato r tum s off whe n the sh ifted
function is executed or if you press again . The SHIFT annunc iator looks li ke thi s:
0.0 0 0 0
SHIFT
Function Names
When you press and ho ld down a function key momentarily, a name for that fun ction
w ill appear in the d isplay. When you ho ld the key down for lo nger than about a half second ,
NULL appears in the display. T hi s means that the function has been cancelled . By pressing
and ho lding a key you can look at the fun cti on name without actually executing the
function ! For example , compute the rec iproca( o f 10.
18 Getting Started
Keystrokes Display
10 10 _
(9 1 IX Press and hold the (9 key for a
0.1000 moment, then release it. Notice that
the function name re mains in the
display while you hold the key
down , and the function is executed
when you release it.
Now nullify a function by holding it down for more than about a half second.
Ke_y strokes Display
10 10 _
1 IX Press and hold (9 until the name
NULL disappears from the display and
NULL appears. When you release
the key, the function is not executed .
10.0000 Previous contents of the display are
returned to the display .
lcLxl 0.0000 Clears the display .
He re i what the complete ALPHA keyboard looks like (for easy reference, the complete
ALPHA key board is also reproduced on the HP-41 C Quick Reference Card, on the back
ofihc calculator and in the function index at the end ofthis handbook). Note that the ALPHA
cha racters shown here o n the top of the keys are not actually printed on the keys.
:e"'"'"'
a b e d e
!!!!1111
' . '
!lll!lllB
APJ>ENO AS T AJ' f:. T
$ A
,,
. .
.
1
o AV[W
Let's write a word in the dis play to see how ALPHA mode works.
Keystrokes Display
1ALPHA l. lCLAI Places HP-4JC into ALPHA mode
and clears the display. Primary func-
tions are now the characters printed
in blue on the lower face of each
key. Shifted c haracters are not
printed on the keys (see page 18).
F F_ When you press a key , the letter
u FU _ printed in blue o n the lower face of
E FUE _ the key is placed in the display.
L FUEL _
l ALPtiA 1 0.0000 Takes HP-4JC out of ALPHA
mode. The HP-41C remembers the
string, FUEL.
20 Getting Started
Shifted functions in ALPHA mode are shown in the illustration on page 19.
Try it no w:
Keystrokes Display
1ALPHA 1 FUEL Places HP-41C in ALPHA mode.
The string, FUEL, retums.
H H_ Begin the new string. The previous
string is lost.
-
p
.41
. !CLA I
HP _
HP -_
HP - 4 _
HP - 41-
H and P are primary characters.
- is a shifted c haracter.
You can recall the ALPHA characters you have keyed into the display by pressing
1viEwl in ALPHA mode . This is actually the 1AVIEW 1 (A LPHA vi ew) function. Viewing
ALPHA strings is covered in section 3 .
Regardless of the mode the calculator is in, the key is a lways the shift function . There
are two other keys on the HP-41C that always remain the same, both the function on the
face of the key and the shifted function . (An exception to thi s is when these keys are
reassigned in USER mode. This is covered in detail in section 4 .) These two keys are:
Keying in Numbers
Key in numbers by pressing the number keys in seq ue nce, just as though you were writing
o n a piece of paper. The deci mal point must be keyed in if it is part of the number (unless
it is to be right of the last digit).
Getting Started 21
A s you key in a number, not ice how the H P-41 C prompts you for each number w ith
an _ ( underscore).
To key in the number 30.6593:
Keyst r ok es D isplay
30.6593 30.6593 _ The number 30.6593, i s in the
display.
umbers that you k ey in in ALPHA mode are only ALPHA characters and cannot be used
in number operations. For example, 1ALPHA I 4 I ALPHA 1 produces the ALPHA character
4. You cannot per form arithmeti c o perat ions on ALPH A numbers.
Numbers entered in ALPHA mode are ALPHA characters and cannot be used in
number functions (i.e., (B , @J , 1LOG1 ).
Negative Numbers
T o key in a negati ve number, press the keys for the number, then pressl cHs l (change sign).
The number, preceded by a minu s ( - ) sign , w ill appear in the display. For example, to
change the sign of the number now in the di splay :
Keystrokes Display
ICHSI - 30.6593 _
You can change the sign of either a negat ive or a positi ve no nzero number in the d isplay .
For example. to change the sign of the negative number now in the display back to positi ve:
Keystrokes Displ ay
lcHsl 30.6593 _
Exponents of Ten
You can key in numbers w ith powers of 10 by pressing leexl (ente r exponen/ of 10)
followed by number keys to specify the exponen! of 10. (N egati ve expo nents are covered
later. ) Again , noti ce how the HP-41C prompts you for the number and the exponen!.
For example, to key in Avogadro's number (6. 0222 x 1026kmol - 1):
Clearing Operations
The 1CLX/A1 Key
1CLX/A1 is a dual purpose key that is used to clear the display. When the HP-41 e is in
ALPHA mode and you press 1CLx/A1, onl y thelCLA J (clea r ALPHA ) functi on is perfo rmed.
The display is blanked when you press 1CLA 1 in ALPHA mode.
When the HP-41C is not in ALPHA mode, that is, in normal mode, pressing 1CLx/A1
performs only the lcLX J function. The display (X-register) is cleared to zero when you
press lcLXJ in normal mode. (Clearing registers is covered later, so don't worry about it
yet.)
First, since we are still in normal mode, let's clear the display (X-register) to zero.
Keystrokes Display
6.0222 26 The number from the previous
example .
lcLXI 0.0000 Clears the display (X- register) to
zeros .
Now , to see how 1CLA1 works in ALPHA mode, write the word SOLAR in the display and
then clear it:
Keystrokes Display
I ALPHAI Places the calculator in ALPHA
mode.
SOLAR SOLAR _ The word.
. jCLAJ Blanks the display.
I ALPHAI 0.0000 Takes the HP-41 C out of ALPHA
mode.
Keystrokes Display
1ALPHA1 Places the HP-41 C in ALPHA
mode .
HYDVO HYDVO _ The example word with an error.
E3 HYDV _ One right-most character deleted.
Getting Started 23
Keystrokes Display
El HYD _ Another right most character
deleted.
RO HYDRO _ The correc ted word .
l cLA I Clears the Alpha register.
[ ALPHA 1 Takes the HP-41 C o ut of ALPHA
0.0000
mode.
In normal mode, when you are key ing in a number,
you can use El to delete and correct digits in the
number. Fo r example, key in Joule 's constant (the
equivalent of a Btu. in ft-lb) , 778.26. Again, notice
how the .. _ . . prompt moves.
Keystrokes Display
778.36 778.36 _ Whoops, Joule's constan! is 778.26.
El 778.3 _ One ri ght most character deleted.
El 778. _ Another characte r deleted.
26 778.26 _ The correct Joule s constan!.
. [ CLxl 0.0000
In both ALPHA and normal modes, EJ only works as a character-by-character correction
key when the _ prompt is in the display. lf the _ prompt is not present in normal mode,
then pressing El c lears the X-register to zeros (like ai CLxl ). The El key always deletes
one character at a time when you are key ing in ALPHA charac te rs.
The El key can be used in man y different si tuation s to aid you in correction of entries
and error recovery. You w ill leam mo re about the El fun ction as you progress through
the handbook.
To c lear the e ntire calculator (ali programs, reg isters, assignme nts, tlags, etc.) with the
"master clear:" turn the HP-41C off, hold down the El key, and turn the calculator
back on again . The display will show MEMORY LOST.
Functions
In spite of the large numbe r of function s available in the HP-4 1C, you wi ll find a li
functions simple to execute:
When you press and release a function key, the calc ul ator immediately executes
that function.
24 Getting Started
When you press and hold a function key for Less th an about a half second, the
calculator di splays the function na me and the n exec utes the function when you release
the key.
When you press and hold a function key for more than about a half second, the
c alculator first displays the function name and then displays NULL . The function is
not executed when you release the key.
For example, to calculate the number of square meters in a 160-me ter square field ( L60m X
160m or 1602) :
Keystrokes Display
160 160 _
Keystrokes Display
25,600.0000 Number from previous operation.
160.0000 The answer.
@ and ~ are examples of one-number function keys; that is, keys that execute upon a
single number. Ali standard HP-41 C functions operate upon either one number or two
numbers at a time (except the stati sti cs functions like ~ and ~ - more about these
late r).
One-Number Functions
To use any one-number function :
For example , to use the func tion ~, you first key in the numbe r represented by x, the n
press the function key ~. To calculate \4, key in 4 (the x-number), and press ~ .
Keystrokes Display
4 4_
~ 0.2500 When you press and release ~ ,
the function is executed.
Getting Started 25
Here are sorne more one-number function problems. Remember, first key in the number,
then execute the function .
Two-Number Functions
Two-number functions must have two numbers present in order for the operation to be
performed . Both numbers must be in the calculator before the functio n is executed. [B ,
G , 0, and GJ are examples of two-number functions.
When you must key in two numbers before performing an operation, use the IENTER 1 key
to separate the two numbers .
Use the fENTER I key whenever more than one number must be keyed into the
calculator before executing a function.
lf you need to key in only one number for a func tio n, you do not need to press IENTER 1.
T o place two numbers into the calc ulator and perform an operation:
1. Key in the firs t number.
2 . Press IENTER I to separate the first number from the second.
3. Key in the second number.
4 . Execute the functi on.
Keystrokes Display
15 15 _ The first number.
IENTERt l 15.0000 Separate the first number from the
second.
5 5- The second number.
(}] 20.0000 The function a nd ans wer.
The [l:) function is also a two-number operation. lt is used to raise numbers to powers,
and you can use it in the same simple way that you use every other two-number function:
When working with any function (including [l:) ) , yo u should remember that the displayed
number is designated x by the function symbols.
So @J means square root of the displayed number, ~ means l/displayed number, etc.
Keystrokes Display
4 4_
IENTER I 4.0000
7 7_
. [l:) 16,384.0000
Now try the following problems using the [l:) function, keeping in mind the simple rules
for two-number functions:
Chain Calculations
The speed and simplicity ofthe Hewlett-Packard logic system is most apparent during chain
calculations. Even during the longest of calculations, you still perform only one operation
ata time, and you see the results as you calculate- the Hewlett-Packard automatic memory
stack (covered in detail in section 3) stores up to four intermediate results inside the HP-41C
until you need them, then inserts them into the calculation. This system makes the process
of working through a problem as natural as it would be if you were working it out with
pencil and paper; but the calculator takes care of the hard part.
Getting Started 27
(.1J--5} X 4 =
IZ X 4- = 48
Work through the problem exactly the same way with the HP-4 1C , one operation at a
time. You sol ve for the intermediate result first. ..
( 17 - 5)
Keystrokes Display
17 17 _
IENTER I 17.0000
5 5-
G 12.0000 lntermediate result .
... and then solve for the final answer. You don't need to press IENTERI to s tore the inter-
mediate result- the calculator automatically stores it when you key in the next number.
Complete the problem now by multiplying the intermediate result by 4.
Keystrokes Display
12.0000 The intermediate result is in the
display.
4 4_ The intermediate result is auto-
matically stored in the HP-4 1C
when you key in thi s number.
48.0000 Pressing the function ( 0 ) multi-
plies the new number a nd the inter-
mediate result , g iving the final
answer.
Because the HP-41 C stores intermediate results automatically, you don 't need to remember
them.
28 Getting Started
Now try these problems. You don't need to clear the display before you start each
problem-the HP-41C uses only the numbers for the current problem.
Problems that are eve n more complicated can be sol ved in the same simple manner, using
the automatic storage of intermediate results. For example, to solve (6 + 5) x (9 - 3)
with pencil and paper, you would:
You work through the problem the same way with your HP-41C. First solve for the
intermediare result of (6 + 5):
Keystrokes Display
6 lENTER I 6.0000
s0 11.0000 lntermediate result.
Now perform (9 - 3): (Since you must key in another pair of numbers before you can
perform a function, you use the 1ENTER I key again to separate the first number of the pair
from the second .)
Keystrokes Display
9 (ENTERtJ 9.0000
38 6.0000 lntermediate result.
Getting Started 29
Nex t, multipl y the inte rmediate answers together for the final answer.
Keystrokes Display
otice that you didn ' t have to write down or remember the intermediate answers before
you multiplied. The HP-4 1C automaticall y stacked up the inte rmediate results for you and
brought them out o n a last- in, first-out basis when it was time to multiply.
No matter how complicated a problem may look , it can a lways be reduced to a se ries of
one- and two-number operations.
Now try these problems. Remember to work through them as you wou ld with pencil and
paper, but don' t worry about intermediate answers -they are handled automaticall y by the
HP-4 1C.
( 16 X 38) - ( 13 X 11 ) 465.0000
(27 + 63) -7 (33 X 9) 0.3030
(V( 16.38 X 5)) -7 .05 180.9972
4 X ( 17 - 12) -7 ( 10 - 5) = 4 .0000
Display Control
The HP-41 C provides many display capabilities fo r both numbers and A LPHA characte rs.
You can cont rol the fo rmal of how ali numbe r~ are seen in the di splay. But regard less
o f the di spl ay optio ns in e ffcct, the HP-4 1C always represents each num ber intem a ll y as
a 10-di g it m anti ssa and a 2-di g it exponen! o f 1O. Thus when the calculato r is set to display
o nly four dig its past the deci ma l po int , the fi xed constant pi , whic h is a lways represe nted
inte m all y as 3.141592654 x IO, will appear in the di spl ay as 3. 14 16.
Fo r example. whe n you compute 2 TT , you might see the answer to o nly fo ur decimal
places:
Keystrokes Display
2 00 6.2832
However, ins ide the ca lc ulato r ali numbers have 10-di git mant issas and 2-digit exponents
of 10. So the calcul ator actual/y c alcul ates us ing ful! 10-digit nu mbers:
__,_.._,,__
6. 283 185308 IO X
Yo u see o nly these d ig its ... / ' ... but these di g its are also present intem ally.
ma11ner in which a number is displayed. The actu al number itse lf is not altered by any of
the dis play control functions.
When you specify a display mode by pressing lII!:J , ~, o r IENGI , the Continuous
Memory o f the HP-4 1C "remembers" that formal. The formal rema ins the sa me until
you change it: even while the HP-41C is turned off.
Sign - - - - - -
t
Decimal point
Let's put a numbe r in the display so you can see how fixed-poi nt d ispl ay looks:
Keystrokes Display
2.24 136 2.24136 _ The num ber.
F/X _ The di splay shows the funct ion
lII!:l
(lII!:) ) and prompts you for the
digit with an _.
2 FIX 2 Whe n you satisfy the prompt , the
display shows the function when
you hold the 2 key down briefly ...
2 .24 . . . and then s hows the actual formal
whe n you re lease the key. The
number is rounded off to two
decimal places. lnte m a lly, how-
ever, the number ma intains its
original va lue of 2.241360000 x
10.
FIX_ T he functio n and prompt.
lII!:l
o 2. T he number is rounded off to O
decimal places.
lII!:l 9 2.241360000 The fo rmatted number. Trailing
zeros are added to fi ll o ut the full
nine dec ima l places.
lII!:l 4 2.2414 The di splay rounds upward if the
first hidden digit is 5 or greater.
Display Control 33
Later. in section 14. you wi ll leam how to control the way commas and decimal points are
used in displayed numbers. In [Iill formal , the H P-4 1C norma lly displ ays numbers with
commas separatin g groups of numbers like thi s: 99, 187,224.00. The H P-41 C can also
display nu.mbers w ithout the comma separators. like thi s: 99187224.00 . For European
uscrs. the formal can even be changed to display numbers w ith separators and decimal
notation like th is: 99.187.224,00 or without separators, like this: 99187224,00 . lfyou wish
to change thc way your HP-4 1C presently displays numbers, turn to secti on 14 and read
about the decimal point fl ag and the digit grouping flag.
8-digit mantissa
r
Sign of exponen! of 10
Scientific notation is selec ted by press ing ~ followed by a digit key to spec ify
the number of decimal places to which the number is rounded . For example, place the
spced of light (299. 792 ,500 m/s ) in the di splay and set the ca lculator to sc ientific notation.
Keystrokes Display
299792500 299, 792,500 - Speed of l ight in a vac uum.
filD SCI _ The function and the pro mpt.
3 2.998 08 l ndicates 2.998 x 108 . Notice th at
the di spl ay rou nds ifthe first hidden
manti ssa digit is 5 or greater.
filD o 3. 08 l ndicates 3 x 10.
34 Display Control
Specified significan!
digits after the first one
Exponen! of 10
Sign- - - - - - I 2. 3 l~ .S 5 1 8 09 - - - - - -always a multiple
of three
t
One significan!
digit always present
t
Sign of
exponen! of 1O
Th is is particularly usefu l in sc1enti fic and engineering calculati ons, where units of measure
are often spec ified in multiples of three. Refer to the prefix chart below.
Eng ineering notation is selected by pressing IE NG 1 followed by a number key. The fi rst
significan! digit is always present in the display, and the number key specifies the number
of add itional significan! digits to w hich the display is rounded. The deci mal point always
appears in the display . For example, key in 28. 17939 x 10- 16 and change the number of
significant digits displayed to see what happens to the number. Remember that the HP-41 C
pro mpts you (with ENG - ) for the number of significan! digits.
Keystrokes Display
28.17939 28.17939 _
IEEXllCHSI 16 28.17939 - 16 The number.
Display Control 35
Keystrokes Display
. IENG J ENG _ The di splay fu nctio n and prompt.
2 2.82 -15 Eng ineering no tatio n di splay.
Number appears in the di splay
rounded off to two significant dig its
after the o mnipresent firs t one.
Power of 10 is proper multiple of
three .
IENG I 3 2.818 -15 Dis play is rounded off to third
significan! d igi t after the first one .
,ENG J 0 3. -15 Display is ro unded off to first
sig nifican! di g it.
Notice th at round ing can occ ur to the /eft of th e decimal point , as in the case of leNG I O
s pecified above.
When eng ineering no tation has been selected , the decimal point shi ft s to maintain the
exponen! of 10 as a multiple of three. Fo r example , mult iplying the number now in the
calcula to r by 10 twice causes the dec imal poi nt to shift to the right twice w ithout alte ring
the exponen! of 1O:
Keystrokes Display
IENGJ 2 2 .82 -15 The nu mber.
100 28.2 -15 The decima l point hifts.
10 0 282. -15
However, multiplying again by 10 causes the exponen! to s hift to ano ther multiple ofthree.
Since you specified leNGI 2 earlier, the calculator mainta ins two sig nifi can! digits a fter
the fi rst o ne when you mu lt ipl y by 10 agai n.
Keystrokes Display
100 2.82 -12 The decima l point s hifts. Po wer of
10 shifts to 10- 12 Display maintai ns
two significan! di g its after the firs t
one.
0.00 00 C lears the di splay.
0.0000 Sets the calc ulator back to ITill 4.
Annunciators
The HP-41C display contains seven "annunciators" or key words that tell you the status
of the calculator. Each annunc iator tells you something about how the calculator is
operating at that moment.
The conveni ence of the HP-41 C display annunciators allow you to concentrate o n the
proble m at hand - there is no need to remember the status of the calculator. Just look
at the display; you can immediately see all HP-41C o peration conditions.
Section 3
This section covers the detailed operation of the automatic memory stack and the ALPHA
register. lf you w ish to leam how the stack and ALPHA register work, and how you can take
advantage of sorne of the more powerful features of the HP-41 C, we suggest that you work
through this section. Otherwise, you may wish to skip this section for now and continue
with section 4 , Us ing HP-41C Functions.
The T 0.0000
Automatic z 0.0000
Memory Stack y 0.0000
X 0.0000 (Displayed)
When you are in normal mode, that is, not in PRGM, USER, or ALPHA mode, numbers
that appear in the display are the same as the contents of the X-register in the calculator.
Each register in the stack holds a 10-digit number and its 2-digit exponent of JO. ALPHA
characters and their relationship to the stack are covered later. For now , !et' s work with just
numbers.
Basically, numbers are stored and manipulated in the HP-41 C "registers." Each number,
no matter how few digits (e.g., O, 1, 5) or how many (e.g., 3. 14159265, -15.78352, or
l. 7588028 x 1011 ) , occupies one entire register. We label these registers X, Y, Z, and T.
They are "stacked, " like shelves, one on top of the other, with the X-register on the bottom
and the T-register on top.
The contents of these registers, as well as ali other information in the HP-4JC , are
maintained by the calc ulator's Continuous Memory. Even when the HP-41C is tumed off,
the values stored in the stack registers are ali " remembered" by the calculator.
When you execute a function, the result is always placed in the X-register (the display). So
when you compute the reciproca) of 5 .. .
Keystrokes Display
5~ 0.2000
39
40 Automatic Memory Stack and ALPHA Register
... the result is placed in the X-register and is seen in the display. The contents of the stack
registers now look like thi s:
T 0.0000
z 0.0000
y 0.0000
X 0.2000 (Displayed)
Keystrokes Display
I ALPHAI
The IAPPENDI function (. K in ALPHA mode) enables you to build on to a string in the
Keystrokes Display
1 ALPHA 1
ADD ADD _ The initial string.
I ALPHA I 0.2000 Take s the HP-4 1C out of ALPHA
mode .
1ALPHA1 ADD Places the HP-41 C back into
ALPHA mode .
IAPPENDI ( . K) ADD _ This enables you to continue
adding c haracters to the string
into ALPHA register.
ITION ADDITION The entire string.
i ALPHA 1 0.2000
If you don ' t press IAPPENol before adding new characters, the new characters will clear the
previous string from the ALPHA register. For example :
Keystrokes Display
1ALPHA 1 ADDITION The old string .
RUN RUN _ The new string clears the previous
string fro m the ALPHA regi ster.
0.2000
When the calculator is in normal mode, pressing . lcLxl (clear X) clears the X-register and
di splay to zeros.
For example, the stack (automatic memory stack) now looks like thi s (with data intact from
the previous example):
T 0.0000
z 0.0000
y 0.0000
X 0.2000 (Displayed)
Pressing lcLxl now clears the X-register (display). Notice that the function name
appears when you press and hold 1CLx1 for a moment.
Keystrokes Display
ICLxl CLX When you press and hold the key for
0.0000 a moment , the func tion name
appears in the di splay.
T 0.0000
z 0.0000
y 0.0000
X 0.0000 (Displayed)
lf the - (underscore) prompt follows any ALPHA strin g or number in the di splay, you can
delete one character or digit ata time from that string or number by pressing 8. If the _
prompt does not follow the di splayed ALPHA stri ng or number, pressing 8 clears the
display.
While you are keying in numbers in normal mode, pressing B deletes one ri ght-most
number at a time . 8 clears the display to zeros if you delete ali of the numbers in the
display .
For example, key in a number, edit it, and then delete it entirely usi ng 8 . Note the
movement of the _ prompt.
Automatic Memory Stack and ALPHA Register 43
Keystrokes Display
5.6 5.6 _ The numbe r and _ prompt.
El 5. _ One right-most digit deleted .
7 5.7 _ The edited number.
EJEJ 5_ Delete the 7 and the decimal point.
El 0.0000 Deleting the last number clears
the X-register to zeros .
While you are keying in ALPHAs, pressing EJ also deletes one right-most character ata
time, but blanks the display when you delete ali of the characters. Again, notice the
movement of the _ prompt.
Keystrokes Display
1 ALPHA J ABB ABB _ The ALPHA string.
El AS _ One character deleted.
e ABC _ The corrected string.
EJEJEJ When the last ALPHA is deleted,
the display is blanked, Ieaving the
_ prompt. The stack is not disturbed.
0.0000 Retum to normal mode.
To aid in recovering from othe r keystroke errors, El lets you clear the X-register with a
single press.
Keystrokes Display
2@] 1.4142 The result .
El 0.0000 The X-register has been cleared to
zeros (no _ prompt was prese nt).
Keystrokes Display
IRCLJ RCL _ The function and prompt.
9 RCL 9 _ Whoops, you decide not to do this.
El RCL __ The input may be deleted and
changed.
El 0.0000 Or you may clear the entire
operation.
Using El is easy and conveni ent, and you will leam how El is used in other ways for
correction as you continue reading this handbook.
44 Automatic Memory Stack and ALPHA Register
Keystrokes Display
4 I E~ I 4.0000
31 ~ 1 3.0000
2 1 ~ 1 2 .0000
1_
T 4.0000
z 3.0000
y 2.0000
X 1_ (Displayed)
Now press ~ :
Keystrokes Display
~ 2 .0000
o
T 1.0000
z 4 .0000
y 3.0000
X 2.0000
Whe n you press ~ , the stack contents shift downward one register. The Iast number in the
X-register rotales around to the T-registe r. When you press ~ again, the stack conte nts
again roll downward one register.
Automatic Memory Stack and ALPHA Register 45
Keystrokes Display
J 3.0000
o
T 2.0000
z 1.0000
y 4.0000
X 3.0000
Cont inue pressing J until the stack retums to the original position.
Keystrokes Display
J 4.0000
o
T 3.0000
z 2.0000
y 1.0000
X 4.0000
1.0000
o
T 4.0000
z 3.0000
y 2.0000
X 1.0000
Four pre sses of the J functi on will roll the stack down fo ur times, retuming the stack
conte nts to the ir original registers.
The IB!) ( rol/ up) fu nction works the same way as J except th at IB!) rolls the stac k
contents up instead of down .
Exchanging x and y
The lx~ YI (x ex change y ) function exchanges the contents of the X- a nd Y-registe rs
without c hang ing the contents of the Z- and T-registers. If you press l x~ YI with data
intact from the previous example, the numbers in the X- and Y-registers will be changed . ..
T 4.0000 T 4.0000
z 3.0000 z 3.0000
y 2.0000 ::::::>-<y 1.0000
X 1.0000 X 2.0000
46 Automatic Memory Stack and ALPHA Register
Try it now:
Keystrokes Display
lx~ Y I 2.0000
Notice that whenever you move numbers in the stack using one of the data manipulation
functions the actual stack registers maintain their positions. Only the contents of the
registers are shifted. Later, in section 6, you will leam how to exchange the X -register with
any other storage register in the HP-41C .
In add ition to letting the calculator know you are fi nished key ing in a number, pressing
l ~ I also moves the number into the stack . Here is what happe ns whe n you key in a
number and press l ~ I:
Keystrokes Display
987.3 987.3 _ The nu mber.
1 ~ 1 987.3000
First, when you key in the number, the stack is cha nged ...
Then, when you press l ~ I, the number is pushed into the Y-register. The contents of
the stack are then c hanged ...
The value in the X-registe r is duplicated and pushed into the Y-register. The numbers in Y
and Z are pushed up to Z and T , respecti vely, and the number in T is lost off the top of the
stack.
Automatic Memory Stack and ALPHA Register 47
lm mediately after you press IENTER I, the X-register is prepared fo r a new number, and
that new number writes over the num ber in the X-register.
Now, continue by keying in a new number.
Keystrokes Display
537.91 537.91 _ The new number is in the X-register.
The !ENTalt 1 key has separated the digits of the fi rst number from the digits of the second
number and the stack now looks like this:
T 1.0000
z 2.0000
y 987.3000
X 537.91
Notice that numbers in the stack do not move when a new number is keyed in immediately
after you press IENTER I, 1CLxl, ~, or !B . However, numbers in the stack do lift upward
when a new number is keyed in immediately after you execute most other functions,
including !E) and l x~ YI. Refer to appendix C for a complete list of the operations that
cau e the stack to li ft.
Keystrokes Display
. jCLxl 0.0000
27.93 27.93 _ A number is in the X- register.
IENTER I 27.9300 Places the number in Y-register.
167.54 167.54 _ A new number is in the display.
~ 12.9437 The answer is in the display and the
X-register.
48 Automatic Memory Stack and ALPHA Register
0.0000
0.0000
27.9300
167.54 _ (Displayed)
Then, when you pressed@, the result , the square root ofthe number in the X-register, was
placed in the X-register (displayed) .
0.0000
0.0000
27.9300
12.9437 (Displayed)
The one-number function executes upon onl y the number in the displayed X-register, and
the answer writes over the number that was in the X-regi ster. No other stack register is
affected by a one-number function.
17
+ 46
63
Numbers are positioned the same way in the calculator. Here's how it is done.
Keystrokes Display
lcLx l 0.0000 Clears the displayed X-register.
17 17- 17 is keyed into the X-register.
IE.NTERI 17.0000 17 is copied from X into Y .
46 46 _ 46 writes over the 17 in the display .
m 63.0000 The result is in X and the display.
Automatic Memory Stack and ALPHA Register 49
The simple old-fashioned math notation helps explain how to use your calculator. Both
numbe rs are always positioned in the calculator in the natural order first , then the opera-
tion is executed. There are no exceptions to this rule. Subtraction , multiplication, and
divi sion work the same way. In each case, both numbers must be in the proper position
before the operatio n can be performed.
Chain Calculations
You've a lready leamed how to key numbers into the calculator and perform calc ulations
wit h them. In each case you first needed to position the numbers in the stack manually using
the 1ENTEJ! I key. However, the stack also performs man y move ments automatically. These
automatic movements add to its computing e ffic ie ncy and ease of use , and it is these move-
ments that automatically store intermediate results. The stack automaticall y " lifts" every
calculated number in the stack when a new number is keyed in because it knows that after it
completes a calculation, any new digits you key in are part of a new number. Also, the stack
automaticall y " drops" numbers into position when you pe rform two-number operations.
To see how it works, let's solve 21 + 38 + 19 + 53 = ?
For purposes of simplification , thi s example shows the stack cleared to zeros.
After any calculation or number manipulation, the stack automaticall y lifts when a new
number is keyed in . Because operations are performed when functions are pressed, the
length of such c hain problems is unlimited unless a number in one of the stack registers
exceeds the range of the calculator (up to 9.999999999 x 1099) . When the range of the
calculator is exceeded, the HP-4 IC immediately ind icates OUT OF RANGE in the di splay .
Later you will learn how to instruct the HP-41C to ignore these types of overflows.
In addition to the automatic stack lift after a calculation, the stack automatically drops
during calculations involving both the X- and Y-registers. lt happened in the above exam-
ple, but let's do the problem differently to see thi s feature more clearl y. For clarity, firs t
press 1CLX1 to clear the displayed X-register. Now , again sol ve 2 1 + 38 + 19 + 53 = ?
The same dropping action al so occurs with G , 0 and 0 . The number in T is duplicated
in T and drops to Z, the numbe r in Z drops to Y, and the numbers in Y and X combine to
g ive the answer, which is in the di splayed X-registe r.
This automatic lift and drop of the stack give you tremendous computing power, since you
can retain and position intermediate results in long calculations without the necessi ty of
reentering the numbers.
52 Automatic Memory Stack and ALPHA Register
Order of Execution
When yo u see a pro blem like thi s o ne:
you mus t decide where to begin before you e ver press a key .
Experienced HP calculator users have leamed that by starting every problem at its inner-
most set of parentheses and working outward , jusi as you would with paper and pencil , you
maximi ze the effi c iency a nd power of your HP calculato r. Of course, with the HP-41C you
ha ve tremendou s versatility in the order of executio n.
For exa mple, you could solve so rne problems by working thro ugh them in left-to-right
order, but not ali problems can be sol ved correctly thi s way. The best way to work any prob-
lem is to beg in with the innermost parentheses and work o utward. So, to sol ve the problem
above:
Keystrokes Display
s IENmlI 5.0000
18GJ 0.2778 Res ult of (5 + 18).
5 IENTERI 5.0000
.13 0 0.6500 Result of (5 X . 13).
G 0.9278 Result of [(5 + 18) +(5 X .13)].
37 @ 34.3278 Re sult of 37 X [ (5 + 18)+(5 X . 13)].
3.870 8.8702 Result of
{37X [(5 + 18)+(5X .13)]} + 3.87.
LAST X
In addit ion to the four stack regi ste rs that automatically store intermediate results, the
HP-4 1C also co ntai ns a separate automatic reg ister, the LAST X register. This register
preserves the value th at was last in the display before the exec ution of a function . To place
the con te nts of the LAST X register into the di splayed X-reg ister again , press 1LASTx1.
Remember, if you key in the wrong digits and discover them prior to executing a functio n,
you can use El to edit the number.
In the above example, whe n the first GJ is pressed , fo llowed by I LASTx 1, the contents
of the stack and LAST X registers are changed ...
Constant Arithmetic
You may have noticed that whenever the stack drops because of a two- number operat ion
(nota~), the number in the T-register is reprod uced there . T h is stack operation can be
used to insert a constan! into a problem .
54 Automatic Memory Stack and ALPHA Register
Keystrokes Display
1. 15 1.15 _ Growth facto r .
IENTER I 1.1500
IENTER I 1.1500
(ENTERI 1.1500 Growth factor is now in T .
1000 1,000 _ Starting population .
0 1, 150.0000 Population after 1st day .
0 1,322.5000 Population afte r 2nd day.
0 1,520.8750 Population after 3"1 day.
0 1,749.0063 Population after 4 th day.
0 2,011 .3572 Population after 5th day.
When you press 0 the first time, you calculate 1.15 x 1000. The result ( 1, 150) is
di splayed in the X-register anda new copy of the growth factor drops into the Y-register.
Since a new copy of the growth factor is duplicated fro m the T-register each time the
stack drops, you never have to reenter it.
Notice th at performing a two-number operation such as 0 causes the number in the
T-register to be duplicated the re each time the stack is dropped. However, the ~ function
si mply rotales the contents of the stack registers; it does not rewrite any number, but
merely shifts the numbers that are already in the stack .
55
ON
Section 4
Using The Standard Functions
As you may ha ve noticed by now , not ali of the functions available in the HP-41 C are
printed on the keyboard. In ali, the HP-41C has over 130 standard func tion s, 68 of which
are immediately accessible by press ing functio n keys on the keyboard .
The re st of the HP-41 C function s are accessible in different ways: from the di splay or by
assign ing them to the US ER mode keyboard. You si mply press lxeal (execute) and enter
the function name into the di splay in ALPHA mode. Or even easier, you can assign the
function name to a key location using the 1ASN1 ( assign) function and execute the function at
the press of a single key in USER mode.
With a couple of exceptions , ali functi ons in the HP-41 C can be executed in this manner.
Section 6 lists and explains most standard HP-41 C functions except for progra mming func-
tions. In addition, the function index in the back of this handbook (page 267) lists ali
HP-41C standard functions .
Keystrokes Display
6 6_ The number.
lxeal XEQ __ The HP-41 C is asking: Execute
what?
Ali you do now is place the na me of the function you wish to execute into the display.
Initiall y, the HP-41 C prompts you with __ for a two-digit numeric la bel. As soon as you
press 1 ALPHA 1 to e nter your function name, the prompt changes to a single - , prompting you
for ALPHA characters one at a time . When the HP-41C prompts you for an ALPHA
character, simply press the keys associated with the desired c haracters. Later, in part 11 , you
will see how to use 1xea1 to execute prog rams with numeric labels by spec ifying a label
number instead of an ALPHA name.
57
68 Using the Standard Functions
Now, to compute the factorial of 6, key in the letters of the function name:
Keystrokes Display
i ALPHA l XEQ _ Places the HP-41C into ALPHA
mode.
FACT XEQ FACT _ Tells the HP-41 C that you want
to execute the 1FACT1 (factorial)
function .
720.0000 When you take the HP-4 1C out of
ALPH A mode, the function in the
display is executed. The answer is
in the dis played X-register, just as
with any o ther function .
Let's try another function . When you execute a function that requires sorne input , such as
~ (which requires a number from O throug h 9), the HP-41C will prompt for the input.
(Note that ~ may also be executed directly from the keyboard .)
Keystrokes Display
jxEOl XEQ __ The HP-4 1C prompts: Execute
what?
I ALPHA I XEQ _ Place the HP-41C into ALPHA
mode ...
FIX XEQ F/X _ . . . and spell the function name ,
FIX.
j ALPHA l F/X _ The HP-4 1C now prompts you for
the input required by (!JI).
6 720.000000 The (Iill function is executed when
you enter the required digit.
Any function requiring input, such as the !Iill function shown above, is executed when
you enter the last required digit. (Iill requires o ne digit, so it executes wheir that digit is
e nte red . Sorne other func tio ns require two or three digits, and they are executed when the
final required digit is entered.
Note that the contents of the ALPHA register are not disturbed when you execute a function
from the display.
Using the Standard Functions 59
On the HP-4 1C, you can edit function names before you exec ute , or even term inate
completely, using El. For example:
Keystrokes Display
IXEO I XEQ __ Terminate lxEo l by pressing EJ.
El 720.000000 The functi on is terminated and the
value in X is dis played.
ixEO I XEQ _ _ Begin agai n .
i ALPHA 1 ENT XEQ ENT _ Use El to ed il the function name.
El XEQ EN _ Characters are deleted one at a time.
G XEQ ENG _ The correc ted funclion name.
EJEJEJ XEQ _ lxEol function.
You are bac k to the
El 720.000000 Pressing El again terminales 1XEO 1
and retum s the HP-4 1C to no rmal
mode.
)4 720.0000 Retu m to J 4 .
. iCLxl 0.0000 Clear the displayed X- register.
Errors
lf you attempt to execute a func ti o n (using lxEO I) whose name does no t exist in the
calculato r, the HP-4 1C w ill d isplay NONEXISTENT. For example, if you atte mpt to execute
SINE, the calc ulalor wi ll di splay NONEXISTENT. In lhe HP-4 IC , the si ne function is
spelled SIN.
Fu nctions that require numeric data can not operate o n ALPHA characte rs. lf a functio n
req uiring nume ric data attempts to execule usi ng ALPH A characters, the HP-4 1C displays
ALPHA DATA . A complete listing of all HP-41 C error messages and thei r meaning is g iven
in appendix E.
The Catalogs
The HP-41 C has three cata logs of functions. One ca1alog contai ns ali functio ns and
programs that you ha ve writte n and stored in program me mo ry . Another catalog conta ins ali
functions that become act ive when you plug in exte nsions to the HP-41 C like application
modu les o r o ther accessori es. And the third catalog conta ins ali of the standard HP-41 C
functio ns (thi s catalog conta ins lhe bulk of the functions you w ill be usig).
60 Using the Standard Functions
When you execute the ~ function and s pec ify a catalog number, it begins a t the to p of
the spec ified catalog and lisis the name for each fun ctio n in the catal og.
Entries in the catalogs are organized as fo llows:
T o execute the ~ function , pres s . ~ . The HP-41 C Jill prompt you for the
catalog number w ith CAT _ . Fo r example, list the entire standard functio n catalog.
Keystrokes Display
ICATALOG) CAL The HP-41 C prompts: Wh ich
catalog?
3 CAT 3 The listing begi ns whe n you enter
the cata log number.
+
Xt2
Yf X The last fun ction in the catalog.
User Catalog
As explai ned above, the user catalog ( ~ 1) contains a li of the programs that you ha ve
~tored into program memory . ICATALOG) 1 also has a no ther special capability that he lps you
locate programs in program me mory . As the listing of ~ 1 prog resses, the calc ulator
is positio ned to the location in program me mory of the presently di splayed program na me.
Don't be concemed with this feature now, it is covered in detail in part 11 of thi s handbook.
Using the Standard Functions 61
You need not always list a cata log to the end . You can stop the listing at a ny point by
press ing 1R/ S1 (run!stop ). You can then use 1esr 1(back step) or 1ssr1 (s ing l e step) to
locate the desired func tio n. Or you can even press 1R/ S1 agai n to continue the listing.
lf you wish to completely terminate the listing, press lR/ S 1 and the n E3 .
Keystrokes Display
ICATALOGI 3 +
GRAO
[R/S j GTO Press [R/ S 1 to stop (not terminate)
the li sting.
[esrl GRAO Back step .
l ssr 1 GTO Single step forwa rd.
j SST i HMS Single step again .
[R/ Sj HMS + Restart the listing .
Once the ~ listing is halted (by 1R/ S1 }, pressi ng any other function terminates the
catalog listing and the pressed function is executed .
Pressi ng and holding any key othe r than 1R/S1 or@fil while the catalog is running slows
the catalog listing down for viewing. The key pressed is not executed.
The only key Locations that cannot be reassigned are: , @ID , luseRI , IPROMI , and
1AlPHA 1. Any function that appears in the CATALOG can be reassigned to any location.
Numbers and ALPHA characters, however, cannot be reassigned. The ALPHA mode
functions (1 Av1ew 1, 1ASTO1 , 1AACL l ) can be reassigned to the keyboard for execution in
USER mode.
1f you atte mpt to assign (using 1ASN 1) a function whose na me does not exist in the calculator,
the HP-41C wi ll display NONEXISTENT. The I AsN I function cannot be recorded asan
instruct ion in program memory.
There are 68 key locations th at can be reassigned . To assign or reassign a function to a key
location:
1. Press , ASN 1 . The HP-41 e prompts you for the fu nctio n na me with ASN - .
2. Press 1ALPHA 1 to place the HP-41C in ALPHA mode and enter the name of the
function you wish to assign.
3. Press 1ALPHA1 to place the HP-41 C back into norma l mode .
4 . Press the key (or and the key) to which you wish the fu nction assigned. If you
hold the key down , the di splay wi ll show function name and the reassigned key by
keycode.
Keycodes are a row-column identification of a key location . For example , the keycode
for the l1EJ key is 15. The 1 indicates the firs t row and the 5 indicates the fifth key.
The keycodes for shifted key locations are keycodes prefixed with a - (minus sign ). For
example, the keycode for the la key (shifted l1EJ ) is - 15. The - indicates a shifted key,
the 1 indicates the first ro w , and the 5 indicates the fifth key.
For example, assign the IMEANl func tio n to the @J key.
Keystrokes Display
IASN I ASN _ The HP-41 C prompts: Assign
what?
ASN _ Places the HP-41 C into ALPHA
mode.
MEAN ASN MEAN _ The function name you wish to
assign to a key location .
ASN MEAN _ The HP-41 C prompts: To which
key?
ASN MEAN 13 Press and hold @J for a moment to
see the assign me nt. IMEANl is now
assigned to row 1 column 3, the
@J key location.
When you reassign a func tion to a key location , you may wish to write the function name in
the appropriate place on an overlay (provided with your HP-41 C) and place the overlay on
Using the Standard Functions 63
the keyboard. Al so included with your new HP-4 1C are pre-printed stic ky-back labels
printed with the name of each standard HP-4 IC function . When you assign one of these
func tions to the keyboard , simply place the pre-printed label in the appropriate place on an
overlay. This will he lp you re member where you have placed functions on your customized
HP-4IC.
In addition, the calculator itself he lps you remember the names and locations of reassigned
fu nctions! When you press and ho ld a reassigned key in USER mode, the reassigned
f unction name appears in the display as a reminder.
Note: Key assignments of standard 41 C functions are stored in program memory and
use registers allocated to program memory.
Keystrokes Display
. IASNI ASN _ The HEAT program is no longer
1ALPHA 11 ALPHA 1 ASN _ assigned to the [f!J key. [f!J is now
[f!J 0.0000 the accumulation function in both
USER and normal modes.
Us ing the following keystrokes, detennine the average (mean) timing for the five runs.
(Don' t be concem ed quite yet w ith how the ~ func tion works, it is covered in de tail in
section 6.) Place the HP-41C into USER mode by pressing l usERl. This le ts you use the
IMEANI function that is ass igned to the @J key location .
Keystrok es Display
lusER I 0.0000 Places HP-41 C in USER mode. Ali
custo mized reassigned functions
become ac ti ve. Notice that the
USER annunc iator in the d isplay is
also tumed on .
1cu: l 0.0000
52.6000~ 1.0000
53.5500~ 2.0000
5 1 .2500~ 3.0000
50.6500 ~ 4.0000
48. 7600 ~ 5.0000
(MEAN! (@J ) MEAN Press a nd hold the key fo r a moment.
Notice how the HP-41 C shows the
na me of the func tion assigned to
that key location and not the name of
the function printed on the key .
51.3620 Joel ran an average of 51 .3620
minutes in his five ten-mile runs
(that's about 5. 1 minutes per mile);
a pretty good pace for the marathon.
(USER I 51 .3620 Takes the HP-41 C out of l usER I
mode. Ali normal key functions now
become active on the keyboard.
The (MEANI fu nction remains assigned to the @J key location in USER mode unt il you
change the key assignme nt. This exciting fea ture of the HP-4 1C allows you to custo mi ze
your calculator by assigning the func tions you use the most to the USER mode keyboard .
And you can always use the normal key func tions by simply pressing lusERI again to place
the HP-4 1C back into normal mode.
Using the Standard Functions 65
Note: When you assign a function to a key location, it remains there until you
change it by assigning a new function to that location.
lf you tu m your HP-4 1C off while it is in USER mode, w he n you tum it back o n again , it
remains in USER mode . Th is le ts you custo mize yo ur HP-4 1C and use the custo mized
keyboard easily. *
Execution of 1he normal mode funclions on lhe lop rows of keys in USER mode may take severa! seconds.
To shonen this lime, press @!IDGJ(!J . The reason for rhis is covered in detail in part II.
Section 5
[E
~
:..-AL_P_H~A:
LASTX
=r:R
p .,.;, HP-41C
HP-41CVor
HP-41C with
4 Memory
A(tOO)~
A(tOt)
A (t02)
~62~
lf all memory modules
Modules or
were allocated to stor-
The Quad
age registers, each As3
Memory
additional module As4
Module
would account for the
~99 Ej
following register
addresses:
67
68 Storing and Recalling Numbers and ALPHA Strings
Storing and recalling numbers and ALPHA strings in the extended storage registers i
explained in section 13 (page 197).
Keystrokes Display
2200000 2,200,000 _ The number.
(srol STO __ The HP-41 C prompts: In which
register?
12 2,200,000.000 The number is srored in R 12
lcLxl 0.0000 Clears the displayed X-register.
Notice that when a numbe r is stored, it is merely copied into the storage register, so
2,200,000.000 also remains in the X-register. Storing a number does not change the
contents o f the automatic memory stack.
Recalling Numbers
Numbers are recalled from storage registers back into the displayed X-register in much the
same way they are stored. To recall a number from a primary storage register (00 through
99):
l. Press (RcLI . The HP-41C prompts you for the register address with RCL __
Storing and Recalling Numbers and ALPHA Strings 69
2. Press the number keys of the applicable register address (00 through 99). Addresses
must be 2 digits, e.g., O1, 02, or 50.
For example , to recall the di stance to Andromeda's Great Spiral stored in register R 12 :
Keystrokes Display
JRCL I RCL __ The HP-4 1C prompts: Recall from
which register?
12 2,200,000.000 The function is performed when the
second digit is entered . The distance
to Great Spiral is now in the dis-
played X-register.
Recalling a number into the X-register causes the stack contents to lift. That is, the previous
X value is lifted into the Y -regi ster, the previous Y into the Z-register, the previous Z into
the T-register. The previous value in the T-register is lost off the top of the stack.
Keystrokes Display
19 19 _ The number is in the X-register.
lsrol STO __ The HP-41C prompts: In which
register ?
8 STO ST _ Now the HP-41C prompts: In
which stack register?
z 19.0000 The number is stored in the
Z-register .
lCLX I 0.0000
Keystrokes Display
JRCLI RCL __ The HP-41 C prompts: From which
register?
RCL ST _ Now the prompt is: From which
stack register?
z 19.0000 The number is recalled from Z.
70 Storing and Recalling Numbers and ALPHA Strings
1ASTO1 stores the le-most six c haracters in the ALPHA register into the specified register.
An additional function , 1ASHF1 (ALPHA shift), helps you store strings longer than six
characte rs by shifting the contents of the ALPHA register Left six characters. When you
execute 1ASHF1, the first six c haracters in the ALPHA register are lost . 1ASHF1 is most use ful
in programs and is covered in part 11 of this handbook.
The 1ASTO1 , 1ASHF 1, and 1ARCL1 functions operate on the ALPHA registe r only. The stack is
not di sturbed by these operations unless you specify a stack register address (more about this
in a moment).
To store an ALPHA string that is in the ALPHA register into any primary storage register:
l. In ALPHA mode, press IAsTol (press lsTo l in ALPHA mode). The HP-4 1C
will prompt you for the address with ASTO __
2. Press the number keys of the address of the desired register (00 thro ugh 99). Since
the HP-41C prompts you for the register address, you need not go out of ALPHA
mode to key in the numbers.
For example, to store the ALPHA string MICRO into register R0s:
Keystrokes Display
1ALPHA1
MICRO MICRO _
. IASTOI ASTO __ The HP-41C prompts: In which
register ?
05 MICRO MICRO is stored into Ros
. lCLAI Blanks the ALPHA register.
The string MICRO is now stored into Ros Remember, each storage register can hold a
maximum of six ALPHA characters.
For example, to recall the string stored in register R05 (The HP-4 1C should still be in
ALPHA mode.):
Keystrokes Display
. IARCLJ ARCL __ The HP-41C prompts: From which
register?
05 MICRO _ The string is recalled from R05
1ARCL1 always adds the recalled strings to whatever is already in the ALPHA register. For
example, recall the string from R05 again .
Keystrokes Display
. IARCLJ ARCL __
05 MICROMICRO _ The string is recalled again from
R05 and is added to the string
already in the ALPHA register.
lt is a good idea to remove unwanted ALPHA characters from the ALPHA register befare
you use 1ARCL1 . Simply press 1CLA1 in ALPHA mode to accomplish this.
Keystrokes Display
MICROMICRO_
. ICLA J The ALPHA register has been
cleared.
19.0000
Keystrokes Display
i ALPHA 1
ENERGY ENERGY _ The string.
IASTOJ ASTO __ The prompt: In which register?
8 T ASTO T Stores EN ERG Y in stack register T.
ENERGY
. ICLAJ Clears the displayed ALPHA
register.
72 Storing and Recalling Numbers and ALPHA Strings
VIEW Function
Whe n in norma l, USER , or ALPHA modes, you can view the contents of any HP-41C
registe r without di sturbing the stack . You simply press 1v1Ewl and specify a register
address. For example, to view the contents of R 12 without di sturbing the stack:
Keystrokes Display
. (VIEWI VIEW __ The HP-41 C prompts: View which
register?
12 2,200,000.000 The stack has not been disturbed .
The stack and LAST X registers can also be viewed in the same manner. Simply press GJ
a nd X, Y, Z, T , or L (for LAST X) in response to the prompt.
In ALPHA mode, when you use 1VIEW1 , the 1AVIEW 1(ALPHA view) function is executed .
1AVIEW 1 sim ply places the contents of the ALPHA register into the di splay .
lf you use 1AACL1 to recall a number (not ALPHA charac ters and not ALPHA numbers) from
a register, th at number will simply appear as the corresponding ALPHA c haracters. Num-
bers with exponents will appear with the exponen! prefi xed w ith the le tte r E. For example:
Keystrokes Display
23 lsro l 00 23.0000
i ALPHA 1
. IAACL! 00 23.0000 _ The number now appears as ALPHA
characters and is not valid for
arithmetic functions .
ICLA I
i ALPHA 1 23.0000 The orig inal number is in X.
68 i EEX 1 93 68 93
lsrol 0 1 6.8000 94
Storing and Recalling Numbers and ALPHA Strings 73
Keystrokes: Display:
1 ALPHA 1
. , ARCL 1 01 6.BOOOE94 _ The numbe r now appears as ALPHA
characters and is not va lid for ari th -
met ic functions. The exponent is
marked w ith E .
1. To clear the conte nt s of a single storage regi ster, me re ly store another number there .
The o rig inal number is cleared by the new number.
2. To clear a sto rage register, replace the number in it with zero. For example, to clear
register R 12 , press O (sTol 12 .
3 . To clear ali sto rage registers at once, exec ute the 1CLRG 1 ( clear ali registers) function .
1CLRG1 clears ali c urrentl y a ll ocated data sto rage reg iste rs to zeros . 1CLRG 1 does no t
alter program memory or the automatic memory stack. lcLRGI mus t be ass igned to a
key for execution o r exec uted fro m the dis play.
74 Storing and Recalling Numbers and ALPHA Strings
Remember that because of the Continuous Memory of the HP-41 C, a li information in the
calculator is retained, even when the calculator is turned o ff.
Use lcLRGI now to clear ali c urrently allocated storage regi sters.
Keystrokes Display
lxEal XEQ __
1 ALPHA 1 CLRG 1 ALPHA 1 6.8000 94 Ali currently allocated storage
registers have been c leared .
To clear the entire calculator (ali programs, registers, assignments, flags, etc.) with the
" master clear: " tum the HP-41C off, hold down the B key , and tum the calculator
back on again. The display will show MEMORY LOST.
Storage Register Arithmetic
Arithmetic can be performed u pon the contents of aJI storage registers by executing 1STO1
followed by the arithmetic function followed in tum by the register address. For example:
Operation Result
1STO1[I)01 Number in X-register is added to the contents of register R0 1 ,
and the sum is placed in to R0 ,. The display execution form of
this is 1sr+ l.
lsTolG02 Number in X-register is subtracted from the contents of R 02 ,
and the difference is placed into R<rz The display execution
form is lsT-1.
lsTo l@03 Number in X-register is multiplied by the contents of R 03 ,
and the product is placed into R 03 . The display execution
form of this is (ST>< l.
lsTolGJ04 Number in R 04 is divided by the number in the X-register,
and the quotient is placed into R 04 . The display execution
form of this is 1sr+ 1.
When storage register arithmetic operations are performed, the HP-41C prompts for the
register address, and the answer is written into the selected storage register. Unless
specified as a register address, the stack remains unchanged .
Keystrokes Display
50 50 _ The X-value.
lsTol[I) ST + __ The HP-41C prompts: In which
register?
Storing and Recalling Numbers and ALPHA Strings 75
Keystrokes: Display:
8 ST + SL GJ specifies the stack. The HP-41 C
now prompts: In which stack
register?
X 100.0000 The value in X, 50, is added to
itself.
Keystrokes Display
7.33 7.33 _
IEEXI 52 7.33 52
lsrol 01 7.3300 52
IEEXI 50 1 50
lsrol@ 01 OUT OF RANGE
To clear the overflow and retum the HP-41 C to the status prior to the error-causing
condition, press a.
Keystrokes Display
B 1.0000 50 Contents of X-register.
IRCLI 01 7.3300 52 Contents of R01
Later, in section 14 of this handbook, you will learn how to tell the HP-41 C to ignore these
kinds of range errors.
Section 6
Functions
Keystrokes Display
2.54 2.54 _ The number.
lcHsl -2.54 _ The sign is cha nged .
ICHSI 2.54 _ Sign is changed back again .
n
78 Functions
Keystrokes Display
. jCLxl 0.0000
1.0973731 1.0973731 _
I EEXI 7 1.0973731 7- Rydberg constan!.
jCHSj 1.0973731 -7 - Sign of the exponen! is c hanged.
lcHsl 1.0973731 7- Sign of the exponen! is c hanged
back again.
Rounding a Number
As you know , whe n you change display format s with o ne of the display control functions
( II!IJ, [ill, o r IENGI ), the number maintains its full value ( 10 digits multiplied by a
two-digit expo ne n! of JO) no matter how many di gits you see. When you execute the
1RNO1 (round) fun c tion , however, the number that is in the di splay becomes the actual
number in the calculator. For example, round the Rydberg constan!, now in the display ,
to two di gits beyo nd the decimal point in (ill fo rmal.
Keystrokes Display
1.0973731 7- Rydberg constan! still in X-register.
lill 2 1.10 07 The di splay forma!. Remember, the
number in the HP-4JC is s till in its
full-accuracy form intemally.
XEQ __ The HP-41 C prompts: Execute
what?
1 ALPHA 1 ANO 1 ALPHA 1 1.10 07 The 1RNO1 func tion is executed.
lill 6 1.100000 07 The (ill 6 display s hows that the
number has been rounded intemally.
IIIKl 4 11,000,000.00 Display mode set to II!IJ 4 .
Absolute Value
So rne calculations requ ire the absolute value, o r magnitude , of a number. To obtain the
absolute value of the number in the X-registe r, execute the 1Aesl func tion . For example,
to calcul ate the absolute value of - 3:
Keystrokes Display
3 jcHsl -3 _
lxeol XEQ __
1 ALPHA 1 ABS 1 ALPHA 1 3.0000 l- 31.
Functions 79
lxeol XfQ __
i ALPHA 1 ABS i ALPHA 1 3.0000 1+31.
Keystrokes Display
123.4567 123.4567 -
lxeol XfQ __
i ALPHA 1 INT i ALPHA 1 123.0000 Only the integer portion of the
number remains.
When o:E!J is executed, the fractional portion of the number is lost. The entire number,
of course, is preserved in the LAST X register.
Keystrokes Display
. , LASTXJ 123.4567 Summons the number from
LAST X .
lxeol XfQ __
1 ALPHA J FRC i ALPHA 1 0.4567 Only the fractional portion of the
number is displayed.
When 1FAC1 is executed, the integer portion of the number is lost. The entire number is
again preserved in the LAST X register.
Y-registers, the y value is divided by x and the remainder is placed back into the X-register.
For example, find 128 modulo 1O:
Keystrokes Display
128 1ENTER I 128.0000 The y-value .
10 10 _ The x-value.
lxeo l
1 ALPHA 1 MQO i ALPHA 1 8.0000 The value is in X .
Reciprocals
To calculate the reciproca( of a number in the X-registe r, key in the number, then execute
the ~ (reciproca/) function . For example , to calcu late the reciproca( of the number
l. 7588028 x 10 11 (the electron charge-to-mass rat io):
Keystrokes Display
1.7588028 leexj 11 1.7588028 11 The number.
~ 5.6857 -12 The reciproca!.
Yo u can also calc ulate the reciproca( of a value in a previous calculat ion without reenteri ng
the number.
Example: In an e lectrical circuit, three resistors are connected in parallel and a single
resisto r is connected in series with the paralle l ci rc uit. The resistors in parallel have values
of 2.7 kilohms, 5.6 kilohms , and 7.5 kilohms, and the series resistor has a value of 680
ohms. Wh at is the total resi stance of the circuit ?
Keystrokes Display
2700 ~ 0.0004
5600 ~ 0.0002
G 0.0005
7500 ~ 0.0001
G 0.0007 Sum of the reciprocals.
~ 1,465.6844 The reciproca ( of the sum of the
reciprocals.
680 G 2,145.6844 Addition of the series value yields
the answer in ohms.
Functions 81
Factorials
The 1FACT 1 function permits you to handle permutations and combinations with ease. To
calculate the factorial of a positi ve integer in the X-register, execute the 1FACT1 function .
For example, calc ulate the number of ways that six people can line up fo r a photograph.
P~ = 6! = 6 X 5 X 4 X 3 X 2 X 1
Keystrokes Display
6 6_
lxeoJ XEQ __
1 ALPHA 1 FACT 1ALPHA1 720.0000 The answer.
The HP-41 C displays OUT OF RANGE for factorials of numbers greater tha n 69.
Square Roots
To calculate the square root of a number in the X-registe r, execute the @ function.
On the keyboard the function !abe! looks like this: @. And when you execute the function
from the display or reassign the function, the name is lsoRTI .
Keyboard execution: @
Display execution: lsoRTJ
Keystrokes Display
16 16 _
@J 4.0000
Now find the square root of the result using ISORTJ in the display:
Keystrokes Display
4.0000
lxeol XEQ __
1 ALPHA J SQAT [ ALPHA J 2.0000
82 Functions
Squaring
To square a number in the X-register, execute the ~ and whe n you execu te the function
from the di splay the name is lxnl (using the up arrow, the shifted function on the IENTER I
key , in ALPHA mode).
Keyboard execution: ~
Display execution: ~
Keystrokes Display
27 ~ 729.0000
Now, find the square of th at number using the di splay execution fo rm:
Keystrokes Display
729.0000
XEQ __
Using Pi
The value of pi accurate to 10 places (3 . 141592654) is provided as a fixed constan! in
your HP-41C . Merely press 0 on the keyboard o r execute @ from the display
whenever you need it in a calculation .
Keyboard execution: 0
Display execution : @
For example , calculate the surface area of Ganymede, one of Jupiter' s 12 moons , using
the formula A = 7Td 2 . Ganymede has a diameter (d) of 3200 miles.
Keystrokes Display
3200 3200 _
~
10,240,000.00
0 3.1416 The quantity pi.
0 32,169,908.78 Area of Ganymede in square miles .
Functions 83
ow, usi ng the display execution form , C!D, find the a rea of Europa, a moon of Jupiter
with a dia meter o f 1950 miles:
Keystrok es Display
1950 1950 _
-~
3,802,500.000
IXEO I XEQ __
1 ALPHA 1 PI 1 ALPHA 1 3.1416 The quantity pi.
0 11,945,906.07 Area of Europa in sq uare miles.
Percentages
The 00 (percent) function i a two-number func tio n th at a llows you to compute percent-
ages. To fi nd the pe rcent age of a num ber:
When you executed 00 , the stack conte nts were changed ...
T 0.0000 T 0.0000
z 0.0000 z 0.0000
y 500.0000 Base. --.. OO ___.. Y 500.0000 Base.
'Yo
X 94.0000 Rate. --.. __.. x 470.0000 Answer .
84 Functions
Notice that the calculated answer writes o ver the percent rate in the X-register, and the
base number is preserved in the Y-register.
Since the to tal tomato weight is still in the Y-register and the weight of the water in the
tomato is in the X-register, the weight of the remainder can be obtained by simply
s ubtracting:
Keystrokes Display
470.0000 The weight of the water.
G 30.0000 The gram weight of sol id matter in
the 500-gram tomato.
Percent of Change
The l%cHI (percent of change) function is a two- number functio n that calculates the percent
increase or decrease from a number in the Y-reg ister to the number in the X-register.
To find the percent of c hange:
1. Key in the base number (us ually, the number that happe ns fi rst in time ).
2. Press 1ENTER+ I .
Keystrokes Display
470 470 _ The weight of the water of the first
(500-gram) to mato.
IENTER I 470.0000
430 430 _ The weig ht of the wate r in Snopes'
to mato .
l xeo l XEQ __
IALPHAI
oCH
IALPHA I - 8.5106 Pe rcent dec rease in we igh1 of water
in Snopes' to mato .
Unary of X
1SIGN 1is a fu nc1ion thal relums O, - 1, or 1 to the X- register depend ing o n the value presently
in X .
Trigonometric Functions
Trigonometric Modes
When you are usin g tri gonometric fu nctio ns, angle s can be ass umed by the HP-4 1C to be
in dec ima l degrees, radians, o r g rad s. Unless you specify o therw ise with o ne of the
trigono met ric mode func ti o ns, the HP-4 1C assumes 1ha1 angles are in decimal degrees .
When you specify a trigonome1ric mode, the HP-41 C re ma ins in that mode until you
change it, even while the HP-4 1C is tumed off.
To select radi ans mode, e xec ute the [RAol ( radia ns) function before using a trigono metric
function . The RAD annunc iato r in the d isplay w ill turn o n to remind you tha t you are in
radi ans mode.
To select g rad s mode , exec ute the lGRAol (g r ads) functi on before using a trigonometric
function. The GRA O annunc iator in the d isplay will tum on to re mind you that you are in
grads mode .
To se lect decima l degrees mode , execute the loeG I (degr ees) function before using a
trigonometric function . Since the HP-41 C normally assumes that ang les are in decimal
degrees, no display annunciator sho ws.
86 Functions
-- 8.S 105
RAO
lxeo l XEQ __
i ALPHA 1 GRAO 1ALPHA 1 -8.5106 Notiee that the GRAO annuneiator
lcLxl 0.0000 tums on.
-- 8 .5 10 5
GRAO
Trigonometric Functions
There are 6 trigonometrie funetions provided by the HP-41 C. Both the keyboard form and
the display exee uti on form of the funetio n a re given : keyboard form first.
~ (sine)*
1
1 s 1N- l or 1ASIN 1 (are sine)
1cos l (eos ine)
leos-! o r lcos l (are cosine)
1TAN1 (tangen!)
1TAN- 11 or 1ATAN1 (are tangent)
Eaeh of these trigonometric fun etions assume that angles are entered in decimal degrees ,
radians, or grads, dependi ng upon the trigonometrie mode selected.
Ali trigonometrie funetions are o ne -number funetions , so to use them, you key in the
number, then execute the funetion. For example, find the cosine of 35 degrees .
In the HP-41C 1T is truncated to JO digits. So, the sine of 1T radians is - 4 . 1 x 10- 10 . This is correct for 1T of 10
digits accuracy.
Functions 87
Keystrokes Display
lxEo l XEQ __
1 ALPHA i OEG 1 ALPHA i 0.0000 Sets the HP-4 1C to degrees mode.
35 35 _
lcosl 0.8192
Now, find the are sine in radians of . 964 .
Keystrokes Display
jxEo i XEQ __
i ALPHA i RAD i ALPHA i 0.8192 Number remains from previous
example. The HP-41C is now in
radians mode, the RAD display
annunciator is on .
. 964 .964 _
. ,SIN- 1
1 1.3017 Radians.
Degrees/Radians Conversions
The 1 o-Rl (degrees to radians) and IR-ol (radians to degrees) functions are used to convert
angles between degrees and radians. To convert an angle specified in degrees to radians,
key in the angle and execute lo- Rl . If you expect to b~ using these function s regularly,
it is a good idea to assign them to the keybad for execution in USER mode. For example,
to change 45 degrees to radians:
Keystrokes Display
45 45 _
jxEol XfQ __
1ALPHA i
O -R
1 ALPHA1 0.7854 Radian.
88 Functions
To convert the angle specified in radians to deci ma l degrees, key in the angle and execute
the 1R-ol function from the display . For example, to convert 4 rad ians lo decimal degrees:
Keystrokes Display
4 4_
!xEol XEQ __
-0
j ALPHA 1
A
j ALPHA 1 229.1831 Decima l degrees.
lcLxl 0.0000
1
f
Hours
h. mm ~1i
1
f
Seconds
f Hundredths of a Second
Tenths of a Second
Minutes
Be fore you begi n the examples, assign IHMsl to the ~ key location and ass ign
~ to the ~ key location. Then place the HP-41C into USER mode.
Keystrokes Display
. IAsNI ASN _
1 ALPHA 1 HMS i ALPHA 1 ASN HMS _
~ ASN HMS 15
0.0000
. IAsNI
i ALPHA 1 HA i ALPHA 1 ASN HR _
-~
ASN HR -1 5
0.0000
0.0000
Functions 89
To convert from decimal hours to hours, minutes, seconds, simply key in the value for
dec imal hours and exec ute IHMSI. For example, to cha nge 2 1.57 hours to hours, minutes,
seconds:
Keystrokes Display
21.57 21.57 _
IHMS] ( ~ ) 21 .3412 This is 2 1 hours, 34 minutes, 12
seconds .
Notice that the di splay is not automatically switched to show you more than four digits
after the decimal point. Unless you change it, the di splay formal re mains the same as
prior to the problem .
To convert from hours, minutes, seconds to decimal hours, simply key in the value for
hours, minutes, seconds in that formal, and execute the ffifil function. For example , to
convert 167 hours, 22 minutes, and 15.68 seconds to its decimal equivalent:
Keystrokes Display
167.221568 167.221568 _ This is 167 hours, 22 minutes,
15.68 seconds .
[Efil ((a) 167.3710 This is 167.3710 ho urs.
Us ing the IHMSl a nd ffifil functions, you can also convert angles specified in decimal
degrees to degrees , minutes, seconds, and vice versa. The formal for degrees, minutes,
seconds is the same as for hours, minutes, seconds.
Keystrokes Display
19.34 19.34 _ The ang le.
IHMSl (~) 19.2024 This means 19 degrees, 20 minutes,
24 seconds.
Keystrokes Display
9.09593 9.09593 _ The a ngle.
[Efil ((a) 9.1665 Answer in decimal degrees.
IUSERJ 9.1665
lcLxl 0.0000
90 Functions
Likewise, angle~ified in degrees, minutes, seconds are added and subtracted using
the IHMs+I and ~ functions.
A ssign IHMS+I and IHMS-1 to the ILool and ~ keys, respectively, for execution in
USER mode.
Keystrokes Display
. IAsNI ASN _
1ALPHA1
HMS. +
1ALPHA1 ASN HMS + _
ILOGI ASN HMS + 14
0.0000
. I AsNI ASN _
1Al..PHA1
HMS . -
1ALPHA1 ASN HMS - _
-~ ASN HMS -- 14
0.0000
luseR I 0.0000
Example: Find the sum of 45 hours, 10 minutes, 50. 76 seconds and 24 hours, 49 minutes,
1O.95 seconds, then subtract 7 hours , 23 minutes, 11 seconds from that result .
Keystrokes Display
45.105076 45.105076 _
IENTER I 45.1051
24.491095 24.491095 _
IHMS+I ( 1LOG1 ) 70.0002
7.2311 7.2311 _
. IHMS-1 ( ~ ) 62.3651
Functions 91
Keystrokes: Display:
~ 6 di splay lets you see the
~ 6 62.365071
whole number.
Display set to ~ 4 .
~4
I USER J
62.3651
62.3651
l cLxJ 0.0000
In the HP-4 1C, trigonome tric functions assume angles in deci mal degrees, decimal radi ans,
or deci mal grad s. lf you want to use any trigonometric func tions o n angles g iven in degrees,
minutes, seconds, you must first convert the angle to dec imal degrees.
Where:
LAT5 and LNG 5 = latitude and longitude of the source (Tristan da Cunha).
LAT d and LNGd = latitude and longitude of the destination (St. Helena).
Solution : Convert ali degrees, minutes, seconds entries into decimal degrees as you key
then:i in. The equation for the great circle distance fro m Tri stan da Cunha to the nearest
inhabitated land is:
Distance = cos- 1 [si n (3703') sin ( 15 55') + cos (370 3' ) cos ( 15 55')
cos (5 43' W - 12 18' W)] X 60
S ince the [BID function is still ass igned to the ~ key location , simply switch to
USER mode.
92 Functions
Keystrokes Display
lusER I 0.0000
5.43 5.43 _ The HP-4 1C is still in loEG I mode.
- ~ (!:a) 5.7167
12.18 12.18 _
- ~ (!:a) 12.3000
G -6.5833
leos! 0.9934
15.55 15.55-
- ~ ( !:a) 15.9167
lsro l 0 1 15.9167
leos! 0.9617
0 0.9553
37.03 37.03 _
- ~ (!:a) 37.0500
lsrol 00 37.0500
leosl 0.7981
0 0.7625
IReLI 00 ~ 0.6025
IReLI 01 ~ 0.2742
0 0.1652
G 0.9277
leos-1 21 .9235
600 1,315.4110 Distance in nautical miles that
Odysseus must sail to vis it Penelope.
luSER i 1,315.4110
leLx l 0.0000
T wo fun ctions are provided in the HP-41 C for po lar/rec tangular coord inate conversions.
Angle (J is assumed to be in decimal degrees, radians, or g rads, depending upon the
trigono metric mode first selected by the loEG I, IRAol, or IGRAol fun ctio ns.
Functions 93
y
O to 180
180 O
-.,....~~~~~~--+~~~~~~~~
X
- 180 O
O to - 180
To conven fro m rectangular x, y coordinates to polar (r, 8) coordin ates (magnitude and
angle, respectively):
Whe n you exec ute the IR-P i func tion, the stack conte nts are c hanged ...
T T
z z z z
y y-coordina te
angle O ---- IP-RJ - Y
X magnitude r---. - X x-coordinate
After you execute IR-P J or IP-Rl, you can press lx~yJ to place the calc ulated angle 8
or the calculated y-coordinate into the X-register for viewing or further calc ulation .
For example, convert rectangular coordinates (4 ,3) to polar form with the angle expressed
in rad ians.
(4 ,3)
Functions 95
Keystrokes Display
IXEOI XEQ __
1ALPHA1 RAD j ALPHA 1 0.0000 Rad ians mode selected .
3 IENTER I 3.0000 The y-coordinate is e ntered into the
Y-register.
4 4_ x-coordinate keyed in .
. IR-P I 5.0000 Magnitude r.
l x~ y) 0 .6435 Angle (} in radians.
Now convert po lar coordi nates (8, 120 grads) to rectangular coord inates .
y
(x,y)
8= 120 grads
Keystrokes Display
lxEo l XEQ __
1ALPHA 1GRAO j ALPHA 1 0.6435 Grads mode se lected . Displayed
result remains from previous
example .
120 IENIDlI 120.0000 Angle (} is placed into the
Y-register.
8 8_ Magnitude r is keyed in .
. I P-R I -2.4721 The x-coordinate.
1X~ YI 7.6085 The y-coordinate.
lxEo )
1ALPHA 1DEG i ALPHA 1 7.6085 Retum s the HP-41C to DEGrees
mode.
96 Functions
The HP-4 1C computes both natural and common logarithms as well as their in verse
fun ctio ns (antil ogarithm s) . The logarithm ic func tions a re: (Notice that the keyboard
executi on and display exec uti on forms of the natural and commo n antilog fun ct ions are
different.)
Natural log Keyboard a nd d isplay: ~ Takes the log o f the value in the
X-registe r to base e (2 .7 18 .. . ) .
Natural a ntilog Keyboard execut ion: ~ Raises e (2. 7 18 ... ) to the power of
Display execution: 0 the value in the X-register. Press
1 - ~to display va lue of e.
Common log Keyboard a nd di splay: 1Lool Computes the log of the value in
the X-register to base 10.
Common antil og Keyboard exec ution : ~ Raises 1O to the power of the value
Display executio n: l to+x 1 in the X-register.
L = L0 - 20 logu1 (r/r0 )
L = 138 - [20 log 10 (3000/2.2)]
Where:
L0 is the so und level at a point near the sou rce ( 138 dB).
r 0 is the di stance from the near po int to the source (2.2 m),
L is the sound leve! at a di stant poi nt , and
r is the di stance from the di stant point to the source (3 km) .
Keystrokes Display
3 IENTER I 7 7_
0 2, 187.0000
Keystrokes Display
16. 13 1CHS1 1ENTER I -16.1300
3 3_
0 - 4, 196.6534
Keystrokes Display
7 ( ENTERtl 7.0000
3~ 0.3333 Rec iproca) of 3.
0 1.9129 Cube root of 7.
Keystrokes Display
1.49 (ENTERt J 1.4900
0.0 15 GJ 99.3333
1.94 IENTER J 1.9400
.67 0 1.5589
0 154.8539
38@E) 0.6157
2~ 0.5000
0 0.7846
0 121.5047 The flo w over the spillway is about
122 cubi c feet per second .
(CLXJ 0.0000
Statistical Functions
Accumulations
Execut ing the ~ fu ncti o n automaticall y g ives you severa) d iffe rent sums and products
of the values in the X- and Y-registers at o nce . In orde r to make these values accessible
fo r sophisticated stati stics proble ms, they are automaticall y placed by the calculator into
a block of six sto rage reg isters that yo u define with the l l:REG 1 function .
Whe n yo u execute (l:REG 1, the HP-4 1C prompts yo u fo r a register address with lREG __ .
The address you specify define s the beginning of a block of six statistical registers.
lf you have not spec ified a block of stat ist ical registers using the (l:REGJ function , the
statistical reg isters will auto matically be R 11 throug h R 16 But if you cha nge the Iocat ion
of the stati stical registers, that change re mai ns in effect unt il you change it again, e ven
while the HP-41 C is o ff.
Before you begin any calculatio ns using the ~ key, you sho uld first clear the storage
registe rs used in accumul atio ns by executing the lcu:I (clear statistical reg isters) func tion .
When yo u key in a number and press the ~ key, the calculator performs each of the
following operatio ns:
1. The number in the X-register is added to the conte nts ofthe fi rst statistical reg ister (the
first statistical register is presently defined as R 11 ).
2 . The square of the number in the X-reg iste r is added to the conte nts o f the second
stati stical reg ister (pre sently defined as R 12 ) .
3. The number in the Y-reg isterof the stac k is added to the contents of the third statistical
register (presently defi ned as R 13 ).
100 Functions
4 . The square of the number in the Y-regi ster is added to the contents of the fo urth
stat istical storage registe r (presently de fin ed as RH ).
5. The numbe r in the X- register is multiplied by the number in the Y-reg iste r , a nd the
produc t is added to the contents o f the fifth stati stical storage reg iste r (presently
de fin ed as R1 5 ).
6 . The number 1 is added to the conte nt s o f the last sta tistical reg ister (now defined as
R 16 ). After ali o f the abo ve steps are performed by the calcula to r, the total number in
the last statisti cal reg ister is placed into the di spl ay a nd the X-reg ister.
W he n you exec ute (B, the stac k a nd statistical storage reg iste r contents are changed . ..
To use any of the summ ations indi v iduall y at a ny time , you ca n recall the conte nts of a
statis tical storage reg iste r into the X-reg iste r by pressing IRCL 1 and the reg iste r addre ss.
O r you can recall the conte nts o f the desired storage registe r in to jus t the di spl ay by pressi ng
1v1ew 1 fo llowed by th e stat istical reg ister address . Re me mber that 1v1ew1 does not
d ist urb the stac k reg isters.
Whe n exec uti on o f (B or ~ causes the conte nt s of an y of the stati sti cs registe rs to
exceed 9. 999999999 x 10 99 , exec ution o f the func ti on is completed , the conte nts o f a li
of the stati stics reg iste rs a re upd ated , a nd 9. 999999999 x J0 99 is placed in the registe r o r
reg isters that overflowed .
Example: Find 2.x, 2.x 2 , 2.y, 2.y 2 , and 2.xy fo rthe paired values ofx a nd y listed below .
y 7 5 9
X 5 3 8
Keystrokes Display
lcu: I 0.0000 C lears the statistical registers
(presentl y R 11 th rough R 16).
7IENTER+ I 7.0000
s(B 1.0000 First pa ir is accumulated , n = 1.
s IBmR+I 5.0000
3 (B 2.0000 Second pa ir is acc umulated ; n = 2 .
Functions 101
Keystrokes Display
9 IENrnu l 9.0000
s(B 3 .0000 Third pair is accumulated; n = 3.
IRcLI 11 16.0000 Sum of x values in R 11 .
IRCL I 12 98.0000 Sum of squares of x values in R 12.
IRcL I 13 21 .0000 Sum of y values in R 13.
IRcL I 14 155.0000 Sum of squares of y values in R 14 .
IRCL I 15 122.0000 Sum of products of x and y values in
R1s
IRCLI 16 3.0000 Number of entries (n= 3).
l cLxl 0.0000
Note : 11 your data {x,} or {y,} contains many redundan! leading dig1ts, you should
refrain from copying them into the calculator For example. 11 your x-data 1s
{999999999, 1000000001, 1000000002}. you should enter the x-data as {-1. 1, 2}
and add the redundan! dig1ts to any x-related answer produced.
Mean
The IMEANI function is used to calculate the mean (arithmetic average) of x and y values
acc umulated in the stat isti cal registers.
When you execute IMEAN I:
1. The mean of x is calculated using the data acc umulated in the first and last statistical
registers. (These are the registers that contain lx and n; presently defined as R 11 and
R 11;.) The resultant value for mean of x is placed in the X-register.
2. The mean of y is calculated using the data accumulated in the third and last statistical
registers. (These are the registers that contain ly and n; presently defined as R 13 and
R 11;. ) The resultan! value for mean ofy is pl aced in the Y-register. Simply press lx~Y I
to bring that value into the X-register for use.
The easiest way to acc umulate the data required for the IMEANI function is by using the
(B function as described above.
Standard Deviation
The 1soev1 function is used to calculate the sample standard dev iation (a measure of
dispersion around the mean) of data accumulated in the statistical registers.
When you execute 1soev1:
1. The sample standard deviation of x is calculated using data accumul ated in the
statistical registers containing lx, l x2, and n. (These registers are presently defined
as R 1., R12, and R1d The resultan! x value is placed in the X-register.
2. The sample standard deviation of y is calculated using data accumulated in the
statistical registers containing ly, ly 2, and n. (These registers are presently defined
as R1 3 R 14, and R 1s-) The resultant y value is placed in the Y-register. Simply press
l x~Y I to place the y value in the X-register for use.
102 Functions
Again , as in the use of IMEANI, the easiest way to accumulate the required data in the
statistical registe rs is by using the (B function .
Remember, when you use (B to accumulate values into the statistics registers, the values
in the X- and Y-registers are accumulated. Ifyou do not intend on using the value in the
Y-register (you are accumulating only single-variable data), be sure to clear both the X-
and Y-registers as well as the statistics registers befo re you accumulate the data using ~ .
Keystrokes Display
lcu::I 0.0000 Clears the statistical registers (still
defined as R 11 through R 16 ) .
Keystrokes: Display:
lxEo l XEQ __
1 ALPHA 1 MEAN 1 ALPHA 1 0.8650 Average mnimum inches of rainfall
per month (mean of x) is in the
X-register.
14.1483 Average maximum inches of rainfall
per month (mean of y) is in the
display.
lxEo l XEQ __
i ALPHA 1 SDEV i ALPHA 1 1.0156 Standard deviation o f mnimum
rainfall per month (x values) is in the
X-register.
3.0325 Standard deviation of maximum
rainfall per month (y values) is in the
display.
The illustration below shows what happens in the stack when you exec ute !MEAN ! or
l. The contents of the stack registers are changed ...
1SOEV
T - - - - - - ---T
z z __ ______,_z z
V y- lost. V i
!MEAN ) Of y Of SOEV 1Of y
X X X IMEAN I 'X ' 1SOEV1 'X
~----~~~LASTX X
For example, suppose that you di scover a recording error in the data you have gathered
on the maximum and min imum rainfalls in Corvallis , Oregon, and you di scover that the
maxi mum and minimum values for January are actually 16.61 and 1.99 , ra ther than 15.51
and 1.99. To account for the cha nge in mean and standard deviation values:
Keystrokes Display
15.51 i ENTER+ 1 15.5100 The incorrect y value .
1.99 1.99 _ The incorrect x value.
IB 5.0000 Incorrect values have been deleted
and the number of entries is now 5
(n = 5).
16.61 IENTER+ 1 16.6100 The corree! y value.
1.99 1.99 _ The corree! x value.
~ 6.0000 The corree! values have been
summed and the number of entries is
now 6.
lxeo l XEQ __
1 ALPHA1 MEAN 1 ALPHA1 0.8650 The correct mean of the mnimum
rainfall per month (mean of x).
14.3317 The correct mean of the maximum
rainfall per month (mean of y).
lxeo J XEQ __
1 ALPHA 1 SDEV 1 ALPHA 1 1.0156 The correct standard de viation of the
minimum rainfall per mo nth
(x-values).
3.1618 The correct standard deviation ofthe
max imum ra infall per month
(y-values).
When you press 1 BEEPJ , the HP-41 C produces a series of audible tones .
1TONE I, whe n followed by a number fro m O through 9, will produce a single audible tone.
Howeve r, 1TONE 1 a llows you to control the kind of sound produced . A lower number
(0, 1, 2, 3, 4) produces a lower pitched sound , and a higher number (5, 6, 7, 8, 9) produces a
higher pitched sound .
Functions 105
Decimal/Octal Conversions
The 1ocr 1(decimal to octal ) and 1DEC 1 (octal to decimal) fun c rio ns allow you 10 con ven
numbe r~ that a re in rhe X-reg isrer 10 their deci mal o r octal equi vale nr s. For exa mple , to
convert the octal number 326 to its decima l equi valen!.
Keystrokes Display
326 326 _
lxEOI XEQ __
1AL.PHA 1DEC 1ALPHA 1 214.0000
To convert the dec imal number 8962 to its octal equi valent:
Keystrokes Display
8962 8 ,962 _
lxEo l XEQ __
1ALPHA 1OCT 1AL.PHA 1 21,402.0000
B 0 .0000 Clears disply.
lf you atte mpt 10 u~e 1OCT 1 when x is noninteger or the ab~o lute va lue of x is greater
than 1.073 .74 1.823 (deci ma l), the d isplay w ill sho w DATA ERROR. lf you attempl to use
1DEC1 when x i ~ noninreger or the number to be con verte d contain~ an 8 o r 9 , the display wi ll
~ho w DATA ERROR. The largest octal number th at can be converted is 7.777 ,777.777.
Paper Advance
Th is special fun c rio n, 1ADV 1, is used in the HP-41 e when you ha ve the optional printer
plugged into an input/output port on the HP-4 1C.
1ADV 1 cau ses
the printer pa per to advance one line, if the pr inrer is plugged into the
HP-41C. In the absence of a printer, !A ovl does no thing . Please cons ult the owne r' s
handboo k included with the printer for additi onal functio ns a nd information .
106 Functions
The HP-4 1C has fi ve functions th at are used to control the operating status of the calculator.
They are ~ , 1OFF J, 1AON 1, 1AOFF 1, and 1PRGM J. Notice that ~ and 1PRGM1 cannot be
recorded as instructions in a program. User mode is controlled either by the lusER 1key or by
a spec ial USER mode flag . You will learn more about tlags in section 14.
Power ON
When you press the ~ key, it simply toggles the HP-41 C po wer on and off. You may
re me mber from section 1 that the HP-41 C automatically turns itself off after 10 minutes
of inactivity to conserve battery power. When you execute the ~ f unction ( 1xea1
1ALPHA 1 ON 1ALPHA 1), th e turn- off fea ture is d isa bled and th e HP-41 e wil l no
longer automaticall y turn itself off. The ~ function stays in effect until you turn the
HP-41 C off.
Power OFF
When exec uted fro m the display orin a program, the 1OFF1 function simply turns the HP-41 e
power off.
PRGM Mode
IPRGMJ , which toggles the HP-41 C in and out of program mode, can only be executed by
pressing the 1PRGM1 key on the HP-4 1C keyboard. There is no display execution form of
lPRGMJ . In addi tion, lPRGMJ cannot be recorded asan instruction in a program .
ALPHA Mode
The IAONJ (A LPHA mode on) function places the HP-4 1C into ALPHA mode, and 1AOFF J
(ALPHA mode off) takes the HP-41 C out of ALPHA mode. !AONJ and 1AOFF1 are most use-
fu l in programs. In addition, noti ce thatlAoN J and 1AOFF 1 perform the same function as the
1ALPHA 1 key on the keyboard.
PART 11
Programming Your Calculator
Section 7
Simple Programming
E ven though the HP-41 Chas many powerful functions, you may wish to perform operations
that are not airead y contained in the calcula'tor. lf you have read through the introduction to
this handbook, you have already seen how you can increase the capability of the HP-41C
greatly by writing your own programs.
Once these prograrns are stored into the calculator' s prograrn memory, they can be executed
exactly like any of the standard HP-41C functions.
The HP-4IC even allows you to define the arrangement of the keyboard. You can com-
pletely customize the calculator by writing your own specialized functions and assigning
them to the keyboard locations you specify.
After most of the explanations and examples in this part of the handbook, you will find
problems to work that !et you practice programming the HP-4IC. These problems are not
essential to your basic understanding of thc calculator, and they can be skipped if you like.
But we urge you to work them. Each problem has been designed to increase your profi-
ciency in programming and use of the HP-41C.
lf you are familiar with othcr Hewlett-Packard handheld calculators, you still may wish to
work through part JI ofthis handbook . The HP-41C has many new capabilities that you can
take advantage of in your programs. Programming the HP-41 C is simple , just like on ali
other HP handheld calculators.
Note that in programming, there are usually severa) ways that a problem can be sol ved. So
after you complete this handbook, you may find that you will be able to sol ve many of the
problems faster, or in fewer instructions, than we have shown in our illustrations.
Now let's begin programming!
What Is a Program?
A program is little more than a series of keystrokes that you would press to sol ve a problem
manually. Except that when you program, the calculator remembers the keystrokes as you
enter them, then executes ali of the specified keystrokes whenever yo u wish. Because of the
special capabilities of the HP-41 C, programs that you write can be treated just like any other
function on the calculator.
Creating a Program
If you read the introduction of this handbook, you created, loaded, and rana program that
calculated the heat loss from a cylindrical water heater. Now let's create, load, and run
another program to show you how to use sorne of the other features of the HP-41C.
109
110 Simple Programming
To calculate the area of the circ le man ually you would first key in the radius r, and then
square it by pressing - ~ . Next you would press 0 to su mmon the quantity pi.
Finally you would multiply the squared radius and the quantity pi together by pressing 0 .
Reme mber that a program is little more than the keystrokes you would press to solve the
problem manua lly. So , in the program, the keys you press to sol ve the problem are the same
as the keys you press to solve the proble m manually . You will load these keystrokes into
program memory:
- ~
0
0
In addition, your program will contain two othe r operation s, l LBL 1 and 1END1 .
Program labe ls that are ALPHA characters can consist of any seven ALPHA characte rs
except , (comma) , . (period), : (colon).
U sed as program labels , the single letters A through J anda through e have a spec ial " local
label" func tion in the HP-41 C. These si ngle Ietters should not be used as the fi rst la bel in
your prog ram. They are most useful when used inside programs . Don ' t be concemed with
local labels now - they are covered in detail in secti on 12 . For now , just remember not to
label your main progra ms with A through J and a through e.
Program labels that are numbers must be two dig its . Number labels are most often used to
label subroutines. Use of numeric labels is covered later.
Simple Programming 111
The HP-41 C ma kes labeling programs easy. (Later, you will see how the calculator actually
prompts you for the Jabe l characte rs. ) While you are keying in an ALPHA Ja bel , the calc u-
Jator ignores improper c haracte rs (e.g., , . : ) a nd <loes not accept any more than seven
cha racters. The HP-41 C does not accept a ny more than two digits in a nume ric labe l.
Here are sorne examples of prope r and improper program labels:
Label Usage. Follow ing are so rne considerati ons that you may find helpful in labeling
yo ur programs.
Nume ric labels can be used any nu mber of times , even in the same progra m.
If you la bel and execute a program with the same name used by the HP-41 C for one of
the HP-41 e standard functions (e. g. ' 1DEG 1 ' 1ABS 1' etc. ) or for a program in a plug-in
application module, the calculator will first search program memory for the program
name. If it is found , the HP-41C will execute the namedprogram . Ifthe name is not
found as a label in program memory , the HP-41 C will then execute the standard
HP-41 C function or the application moduk function having the same name.
, LBL 1 1 ALPHA1 CIRCLE 1 ALPHA1 Assigns the name (CIRCLE) to and defines begin-
ning of the program .
~ Squares the radius.
0 Summons pi.
0 Multiplies r and 1T to give the area of the circle.
1END 1 Defines end o f program space in me mory and stops
the program (more about 1END1 Jater).
112 Simple Programming
Loading a Program
When the HP-41 C is in PRGM (program) mode, the functions and operations that are
normally executed when you press the keys are not executed. Instead, they are stored in
program memory for later exec ution . Ali but the following operations can be loaded into
program memory for later execution .
Ali other functions are loaded into the calculator as program instructions to be executed
later. Functions on the keyboard are loaded by simply pressi ng the associated keys. Func-
tions not on the keyboard are loaded by assigning the function to a key and pressing that key
in USER mode, or using 1xea1 and the function name- just like you would if you were
executing the function manually. (Refer to section 4 if you need to refresh your memory.)
UsinglGTol (!:) 8. When you press lGrol (!:) (!:) , the calculator is positioned to the end of
program memory (after the last existing program in program memory), and is ready for you
to begin keying in the instructions ofyour program. The display will showOO REG nn. The
nn indicates the number of registers that are unused in program memory (more about this
later).
In addition to positioning the calculator to the end of program memory , IGTo l (!:)(!:) also
checks to see ifthe last program you keyed in was terminated with an 1END1 instruction. If an
1END1 was not keyed in as the last instruction of that program, IGTol (!:) (!:) automatically
inserts one. In this way the HP-41C automatically maintains program memory for you!
You can see thatl GTo l (!:) (!:) is extremely use ful. Before you begin keying in a program,
simply presslGTol(!:)(!:) . When you are finished, pressfGTol (!:) (!:) and the calculator
tells you how many registers are left in program memory before and after you key in your
program.
Simple Programming 113
Keystrokes Display
IPRGMl 00 REG 46 Places the HP-41C into program
mode. (Display assumes ali pre-
vious programs and key assign-
ments cleared from calculator.)
IGrolGJGJ 00 REG 46 The HP-41C is now ready for you to
begin programming.
The keys that you mu st press to key in the program for the area of a circle are:
~
0
0
Press the first key s, 1LBL 1 , of the program.
Keystrokes Display
. , LBLJ 01 LBL __
The digits that appear at the left of the di splay indicare the program memory fine number
being shown at any time. We will leam more about "' lines" later in thi s secti on. Now press
the ALPHA keys necessary to complete the instruction.
Keystrokes Display
i ALPHA l CIRCLE 1 ALPHA l 01 LBL TC/RCLE
Any time a program line contains an ALPHA label or ALPHA string, the HP-41 C places T
(rai sed t , for " text") in the di splay following the program line number. Notice th at as you
press function keys for the program, the HP-4 1C prompts you for the input , just like in
normal mode operation.
Now load the rest of the program :
Keystrokes Display
~
02 xr2
0 03 PI
0 04 *
Now press IGrol GJ GJ . This places an 1END1 at the end of the program (in line 5) and
tells you how many reg isters are left in program memory. Notice the PACKING di splay
appears momentarily- packing is covered in detai l late r.
Keystrokes Display
tGrolGJGJ PACK/NG This places an 1END1 in line 5 and
00 REG 44 te lls you how man y registers are left
in progra m memory.
The program for solving the area of a circle (named CIRCLE) is no w loaded into prog ram
memory .
114 Simple Programming
Running a Program
To run a program you can either execute it using the 1XEO1 key, or you can assign it to a key
and execute it by pressing that key in USER mode. Let's try it both ways. You will find the
USER mode operation saves you time and keystrokes.
When you run a program, the HP-41 C has two program execution annunciators that appear
in the display. As program execution progresses, a 7- appears in the display. Each time
the program executes a program label, the 7- moves across the display one position
to the right. When the 7- is in the last position on the right of the display, the ;- resets
back to the left of the di splay .
As an additional aid, the HP-41 C also turn s on the PRGM annunciator in the display
while a program is executing. When the program has completed execution, the PRGM
annunc iator turns off.
After a program executes an I AVIEW I or lv1Ew l, the 7- wi ll not appear, but the
PRGM annunciator wi ll be displayed.
These aids provide an indication to you that the calculator is executing a program. You
never have any doubt during the execution of a long program; you can easily determine that
the calculator is operating.
Take the HP-4 JC out of PRGM mode now by pressing IPRGMI. Notice that the PRGM
di splay annunciator turns off.
Keystrokes Display
IPRGMI 0.0000
Next, use the C IRCLE program you created to fi nd the area of two circles with radi i of 14
inches and 0 .55 meters:
Keystrokes Display
14 14 _ T he first radius in inches.
lxEal XEQ __ The HP-41 C prompts: Execute
what?
i ALPHA 1 CIRCLE 1 ALPHA 1 615.7522 The answer in square inches.
Now, assign CIRCLE to the ~ key location and find the area of two more circles with
radii of JO. 7 inches and 0.439 meters .
Simple Programming 115
Keystrokes Display
. IASNJ ASN _ The HP-41 C prompts: Assign
what?
1 ALPHA 1 CIRCLE i ALPHA i ASN CIRCLE _ Assign CIRCLE to which key
location?
SN CIRCLE 15 The CIRCLE function is assigned
to row 1, column 5 (~) . You can
see the keycode assignment if you
hold the key down momentarily.
0.9503 Places the HP-41C in USER mode .
Any functions you have assigned to
the keyboard become active. The
displayed number remains from the
previous example.
10.7 ICIRCLEI (~} 359.6809 Since CIRCLE is assigned to~ ,
when you press ~ in USER mode,
CIRCLE is executed. The answer is
shown in square inches.
Now compute the area of the second circle. But this time , hold the function key down
momentarily. Notice that the HP-41C prompts you with the USER mode function name.
(When the calculator is set to normal mode and you press and hold the key, the HP-41 C
prompts you with the normal mode function name .)
Keystrokes Display
.439 TC/RCLE Hold the key down momentarily .
i CIRCLE J (~) 0.6055 Square meters .
ICLxi 0.0000
lusERI 0.0000 Takes the HP-41C out of USER
mode .
USER mode execution is that simple! lt lets you execute functions you have written just
like any other function on the HP-41C, and you control the keyboard location. To com-
pletely customize your HP-41 C, you simply assign programs and functions to the locations
you specify.
Unlike the standard HP-41 C functions (which can each be assigned to severa! key loca-
tions), you can only assign a program that you have written to a single key location. The last
key assignment that you specify is the only one that applies.
Included with your new HP-41 C are sorne aids to help you label the keyboard for USER
mode operation. There are plastic overlays on which you can write function names, and
there are pre-printed sticky-back labels printed with the name of each standard HP-41C
function. When you reassign a function to the keyboard , simply write the function name on
116 Simple Programming
an overlay, or ifthe function is a standard HP-41 C function , place its corresponding label in
place on an overlay. When the calculator is in USER mode , simply put the overlay in place .
Notice also th at blank stic ky-back labels are provided so you can write on them and stick
them in place on an overlay .
The reassigned keys re main reass igned in USER mode until you clear the corresponding
programs from program memory or reassign the key location again . For exa mple, 1CIRCLE1
will remain ass igned to the ~ key location until you clear 1CIRCLE 1 from program me mory
or reassign the ~ key agai n.
Program Memory
You may remember from section 5 that program memory and storage reg isters both store
information in the calculator's memory. Me mory can be defined for use either as program
me mory or storage registers. When a portion of memory is defined for use as program mem-
ory, the calculator stores the program information in these registers. A si ngle, complete
operation stored into program memory is called an instruction or line.
When a program line contains an instruction whose name is too long to display ali at
one time, the HP-41 C "scrolls" the information through the display. Section 8 shows
how 1ssrland1 BST lcan be used to view these program lines.
Keystrokes Display
What is the desired data storilge
XEQ
~ register a/location?
IALPHAI SIZE IALPHAI SIZE__ _
021 0.0000 The allocation is now 21 data
storage registers and 42 HP-41 C
program registers or 298
HP-41 CV program registers.
(Number of program registers will
vary if programs or key assign-
ments remain in your calculator.)
IALPHA ISIZE IALPHAI SIZE
017 0 .0000 Retums to the normal allocation.
You can allocate the memory in your calculator entirely to data storage registers,
entirely to program memory registers, or to any combination of data storage and
program memory that you desire.
Continuous Memory
Programs that you record in program memory remain there until you explicitly
remove them. The Continuous Memory of the HP-41C saves the programs, even
when the calculator is turned off.
Remember that the HP-41C wi ll automatically insertan IENol for you when you press
1Grol88
When you press(Grol88 to begi n a new program, the new instructions are added after
the last 1END1 instruction in program memory. The HP-41 C makes progra m memory man-
agement so easy th at you need not worry about where programs are positioned in program
memory. Just press!Grol 8 8 before you begin each program and the positioning is done
for you.
There is a permanent 1END l located at the c urrent bottom of program memory. It
cannot be deleted and instructions cannot be inserted after it. For this reason, even
though the basic HP-41C has 64 registers and the HP-41CV has 320 registers, a
.END . when displayed. Thus, you see 00 REG 46 when you press
time.
I
portion of one register is consumed by the permanent 1END I, which is designated
GTO IOO the first
For the purposes of this book, a "program" or a "program file" is everything between
(and including) the initial LBL for the program and the END of the program.
Clearing Programs
You can clear any program you have loaded into program memory by simply executi ng
1CLP1 (clear program) and specifying the program name.
1CLP1 clears ali instructions of a program includ ing the program label and the program 's
1END 1 instruction. For this reason, it is importan! to include 1END1 instructions in your pro-
grams. For example, if program memory looked li ke thi s ...
00
01 LBLTTEST1 Progra m " TEST 1. "
02 LOG
03 +
04 STO 10
05 RTN
06 LBLTTEST2 Program " TEST2."
07 LOG
08 -
09 STO 11
10 RTN
... and you cleared TEST 1, ali of the instructions from line 00 of TEST 1 down to the first
1END1 (if one existed) would be cleared. But if you include 1END1 instructions, you can
120 Simple Programming
selectively clear programs from program memory. For example, if program memory looked
like this, you could clear just TEST I or TEST2.
00
01 LBLTTEST1
02 LOG
03 + You could clear jusi these instruc-
04 STO 10 tions by executing 1CLP I, specifying
05 END TESTI as the program name, or .. .
00
01 LBLTTEST2
02 LOG
03 - .. . you could clear jusi these
04 STO 11 instructions by executing 1CLP 1,
05 END specifying TEST2 as the program
name.
When you execute 1CLP 1 and do not specify a function name (press 1ALPHA 11ALPHA 1), the
HP-41 C clears the program the calculator is currently positioned to in program memory .
To clear the entire calculator (ali programs, registers, assignments, flags, etc.) with the
" master clear:" tum the HP-41 C off, hold down the 8 key , and tum the calculator
bac k on again. The display will show MEMORY LOST.
Flowcharts are outlines of the way a program sol ves a problem . With over 400 possible
lines (2200 on a fully-enhanced HP-41 C) , it is quite easy to get "lost" while creating a long
program, especially if you try to load a program from beginning to end with no breaks. A
flowchart can help you design your programs by breaking them down into smaller groups of
instructions.
Flowcharts can be as simple oras detailed as you like. Here is a flowchart that shows the
operations you executed to calculate the area of a circle according to the formula A=1Tr2.
Compare the flowchart to the actual instructions for the program:
Simple Programming 121
Flowchart lnstructlons
Keyin
radius
~
~
You can see the similarities between the program and the flowchart . At times , a flowchart
may dupli cate the set of instructions exactly, as shown above. At ot her times, it may be
more useful to ha vean entire group of instructions represented by a single block in the flow-
chart. For example, here is another flowchart for the CIRCLE program:
8
Here an entire group of instructions was replaced by one block in the flowchart. Th is is a
122 Simple Programming
common practice , and one that makes a flowchart extremely useful in visualizing a
complete program .
Flowc harts are drawn linearily, from top to bottom . This represents the general flow of the
program from beginning to end . Although flowcharting sy mbols sometimes vary, through-
out this handbook we have he ld to the convention of circles for the beginning and end of a
program or routine, and rectangles to re presen! the functional operations in a program. We
use diamonds to represen! decisions, where the program must decide which of two
altematives to take.
For example, if you had two numbers and wished to write a program that would display
only the larger, you might design your program by first drawing a flowchart that looked
like thi s:
Yes No
lt would be a si mple matter to go back and insert groups of instructions for each element of
the flowchart. As you work through this handbook , you will become more familiar with
flowcharts. Flowcharts will help you to organize, eliminate errors in logic and flow, and
document your programs .
Simple Programming 123
Problems
l . You have seen how to write, load and run a program to calculate the area of a circle
from its radius . Now draw a flowchart and write a function that will calculate the
radius r of a circle given its areaA using the formular= y-;;;;_ Be sure to set the cal-
culator to PRGM mode and press lorol (!] (!] before you begin programming. Name
the program with l LBL 11ALPHA 1RADIUS 1ALPHA 1and termnate it with 1ENO1 (use
lorol (!] (!] ). After you have loaded the program, run it to calculate the radii of
circles with arcas of 420 square inches, 1.2 square meters, and 0 .9095 square meter.
Program Editing
Often you may wish to alter or add to a prgra m that yo u ha ve keyed into the calculator . The
HP-4J C has severa! edit ing fu nctions that permit you to easi ly change any lines in any of
your programs without re loadi ng the entire program.
Editing Functions
He re are the HP-4 1C editing functions and what they do:
1CLP1 (clear program) Clears the named progra m from progra m me mory. lf the progra m or
an ALPH A labe l inside the program has been ass igned to a key for USER mode execu-
tion, those assignments are a lso nullified .
8 (correction) In PRG M (program) mode, de letes keystrokes while you are e nte ring
data or ALPHAs, or de le tes entire lines th at a re already stored in progra m memory.
l ssr J (single step) In PRG M mode, lssrJ steps forward o ne line in progra m me mory. In
norma l or USER mode, 1ssr1 exec utes the c urre n! line and steps forward one line in pro-
gra m me mory. Al so, while you are using ~ , 1ssr1 steps forward one entry.
1esr 1(back step) In PRGM , normal and USER modes, 1esr 1ste ps back one line in program
me mory; no instruc tions are e xecuted . Also, while you are using ~ , 1esr 1steps back
one entry.
jGro) GJ (go to fine number or ALPHA !abe/) When you specify a three-digit line number,
sets calculator to that line. When you specify an ALPHA labe l , sets the calculator to
that label . Pressing 1GTO) GJ GJ sets the calculator to the end o f program me mory and te lls
you the number of unused registers that re ma in in prog ra m me mory . This al so places an
1END) at the end o f the previous program in progra m memory if one is not airead y present.
1s1ze1 (size of data storage register allocation) When you specify a three-dig it number
indicating an allocation of registers to data storage reg isters, program memory is automat-
ically adjusted and a li re ma in ing registers are a llocated to program memory. Any time the
HP-41 C repeatedly displays TRY AGAIN, you must change the number of storage registers
(which automatic ally changes the size o f program memory) before you continue. Refer to
section 7.
loeLJ (delete program memory lines) Whe n you specify a three-dig it number, the HP-41 C
deletes that number of lines beg inning at the curren! position in me mory . The 1DEL1 func-
tion only deletes instructi ons within a progra m and up to (but not including) an 1END1
125
126 Program Ed1ting
instruction. lf you specify a de lete number that exte nds across the 1END 1 of a program , the
HP-41 C only deletes up to the 1END 1 of the program and stops. lf you attempt to delete more
lines than you have allocated, the calculator simply deletes lines up to the end of program
memory oran 1END 1 instruction and stops.
Let's load a program into program memory and use the editi ng features to modify it.
To determine the heat loss from a cylin~ri cal water heate r, you need to know three things:
the area of the cylinder, the convective heat transfer coefficient , and the temperature dif-
fere nce between the cylinder surface and the surrounding air. In the introduction to thi s
handbook , you wrote a prog ram (HEAT) that dete rmined the heat loss from the water heater
given the area, the heat tra nsfer coefficient , and the temperature difference. In sectio n 7,
you wrote a program called CIRCLE to determi ne the s urface area of one end of the
cylinder.
Keystrokes Display
il'f!GMI 00 REG 44 Places the HP-4 1C into program
mode. HP-4 1C is positioned to the
top of the previous program you
executed .
fGTOl 8 8 00 REG 44 Sets the HP-41 C to the end of
program memory and te lls you the
number of unused registers left in
program memory .
ILBL I
1 ALPHA 1 AREA ( ALPHA 1 01 LBLTAREA Names the program .
lsTol 01 02 STO 01 Stores the radius (r) into storage
register R 01
- 0~
03 Xt2 Squares the radius (r).
04 PI Summons the quantity pi.
0 05 * Multiplies r2 by 1T.
2 06 2 _
0 07 * Computes 27Tr2.
Program Editing 127
Keystrokes: Display:
l x ~ YI 08 X <>Y Moves the he ight (h) into the
X-reg ister.
IRCL I 01 09 RCL 01 Recalls the radius (r) from storage
reg iste r R 0 1.
0 10 * Multiplies r and h (rh).
0 11 PI Summons the quantity 7T.
0 12 * Computes 7Trh.
2 13 2 _
0 14 * Computes 27Trh.
[] 15 + Computes S = (27Tr2) + (2mh).
(GrolGJGJ 00 REG 40 Ends the program and tells you how
many registers are left in prog ram
memory.
Before you can run the AREA program, you must initia/ize it.
lnitializing a Program
When you initialize a program , ali you do is set up a li of the required inputs and mode
settings prior to the actual running of it. Sorne programs conta in initi ali zing routines that set
up the data to run the program. In other programs, like AREA, you may ha ve to initia lize the
program manuall y from the keyboard .
In our AREA program , we must place the height (h) into the Y-register of the stack and the
radius (r) into the X-registe r. To initiali ze AREA with the values of 50 inches for h and 11
inches for r:
Keystrokes Display
IPflGMI 0.0000 Takes the HP-41 C out of program
mode .
50 50 _ The h value.
IENTER l 50.0000 The h value is in the Y-register
11 11- The r val ue is in the X-register.
The AREA program, which solves for the total area of a cylinder, is now initialized for
height of 50 inches and radius of 11 inches.
128 Program Editing
Now compute the area of a cylindri cal water heater that has a height of 58. 185 inches and a
rad ius of 9.25 inches.
Keystrokes Display
58.185 IENTER J 58.1850
9 .25 9.25 _ AREA is initiali zed with a new set
of data before execution.
3,919.2861 Total area of the cylinder in square
inches.
Let 's see how the HP-4 1C editing function s can be used to exa mine and modify AREA.
1. In normal or USER mode , if the calculator is aiready positioned to a line in the desired
program (e.g., if you have just exec uted the program), press 1RTN1. This sets the
calculator to line O of the c urren! program.
2. In normal, USER, or PRGM mode, ifthe calculator is already positioned to a line in
the desired program (e.g., if you have just exec uted the program), press IGroJ G]
000. This sets the calculator to line 000 of the c urrent program .
Program Editing 129
3. In normal, USERor PRGM mode , press 1Grol8 and specify the program na me
(e.g., IGrol 8 1ALPHA1 AREA1 ALPHA1 positions the calculator to the ALPHA
label named AREA in program memory ).
Keystrokes Display
. ,GTOl8
1ALPHA 1AREA 1ALPHA 1 3,919.2861 Number remains from previous
example .
You could also have used IRrNI or 1Grol 8 000 to reset the calculator to the
begining of the AREA program .
Set the HP-41 C to PRGM mode to verify that the calcu lator is now set to the beginning of
AREA . Make su re to set the calculator back to normal mode .
Keystrokes Display
IPRGM l 01 LBLTAREA Program mode . Line 1 of AREA.
IPRGMl 3,919.2861 Back to normal mode.
Keystrokes Display
132 IENTER l 132.0000 The hei ght.
29.21 29.21 _ The radius .
Now press 1ssr 1 and hold it down to see the instruction in the next line. W hln yol release
1ssr1, the next instruction is executed. (If you hold it down too long, the ssr will be
nullified.)
Keystrokes Display
lssrl 01 LBLTAREA lnstruction in line 1 is seen when
you hold 1ssr 1 down .
29.2100 The 1LBL1 AREA instruction is
executed when you release 1ssr 1.
130 Program Editing
The first instruction of AREA is executed when you press and release 1SST 1. Continue
executing the program Iine by line by pressing 1ssr 1. When you hold 1ssr 1 down, you see
the instruction in the next line of the program. When you release 1SST1 that instruction is
executed.
Keystrokes Display
ISST 1 02 STO 01 The next line .
29.2100 Executed.
lssr l 03 X f2 The next line.
853.2241 Executed.
ISST 1 04 PI
3 .1416
1ssr l 05 *
2,680.4826
lssr l 06 2
2.0000
lssT 1 07 *
5,360.9651
lssr 1 08 X <>Y
132.0000
JSST j 09 RCL 01
29.2100
JSST 1 10 *
3,855.7200
lssr l 11 PI
3.1416
lssr l 12 *
12,113.1016
lssr l 13 2
2.0000
lssr l 14 *
24,226.2033
lssr l 15 +
29,587.1684
jssrl 16END
29,587.1684
When you press 1SST1 and reach the 1END 1 of a program, the next press ofl ssT 1 positions the
calculator back to the beginning of the program. You can see that the use of leNo l
instructions is importan!.
Program Editing 131
You have seen how 1SST1 can be used in normal or USER mode to execute a program o ne
line ata time. Using 1ssT1 in this manner can help you create programs and locate errors in
them. Now let's see how you can usel ssT 1, 1esT1, andl GTol0 nnn in PRGM modeto help
you modify a program .
Modifying a Program
Since you have just completed the execution of the AREA program, the calculato r is set
back to the beginning of the prog ra m. You can verify th is by placing the calculator into
PRG M mode (press 1PRGM1 ) . Press 1SST 1 once to see the program la bel.
Keystrokes Display
IPRGMI 00 REG 40
lssT I 01 LBLTAREA The line number and instruction are
di splayed in PRGM mode.
Now let' s modify the AREA program so that the X-register contents will a utomatically be
displayed at certain po ints in the program . We will accompli sh thi s by placing 1PSE1 (pause)
instructions in the progra m to halt the program and display the contents of the X-register for
about o ne second , the n resume execution . (Mo re about 1PSE1 later. )
00
01 LBLTAREA
02 STO 01
03 XT2
04 PI
05 *
06 2 ~ We will insert a 1PSE1 after thi s line
07 * ___-- to display the area of the to p
08 X <>Y of the cylinde r . . .
09 RCL 01
10 *
11 PI
12 *
13 2 . - - - - ... and a 1PSE1 after this line to
14 * dis play the area ofthe cylinder with-
15 + o ut the top and bo ttom.
16 END
Keystrokes Display
. IGTOl0 000 00 REG 40
132 Program Editing
.----- oo
01 LBLT/A REA Pressing 1SST1 when the calculator
is positioned here , moves the calcu-
lator back to the beginning of thi s
program .
~-- 1 6END
Line s in a progra m with names longer than the display are "scrolled" through the di splay
to the left. 1ssr1 and 1esr1 can be used to view ali program fines repeatedly , even long
instruction names that are scrolled .
Re me mber, in normal and USER modes, 1SST1 is used to execute programs one fine at a
time, and in PRGM mode, 1SST1 is used to view programs without execution . Howeve r,
1BST1 is used for viewing only and does not execute in PRGM, normal, or USER modes.
Keystrokes Display
00 REG 40 T he top of the program.
01 LBLTAREA 1ssr1 moves the calculator forward
one fine with each press.
02 STO 01
01 LBLTAREA 1BST 1moves the calculator back one
fine with each press.
Now, use 1ssr 1to move the calculator down to fine 7 so that you can insert the 1PSE1 (pause)
instruction.
Progra m Ed1t1ng 133
Keystrokes Display
lssr l 02 STO 01
1SST 1 03 X T2
1SST 1 04 PI
lssr 1 05 *
1SST 1 06 2
lssr l 07 * We will insert a 1PSE1 after line 7.
You can see that the HP-4 1C is now set at line 7 of progra m memory . If you press a record-
able operation now, it will be loaded into the next line, line 8, of progra m memory, and ali
subsequent instructi ons will be " bumped " down in program me mory.
Thus , to load the 1PSE 1 instructi on so that the program will review the contents of the
X-registe r:
Keystrokes Display
lxea) 08 XEQ __
1 ALPHA 1 PSE 1 ALPHA 1 08 PSE The 1PSE J instruction is now stored
in line 8.
Now let's see what happened in program memory when you loaded the 1PSE1 instruction.
With the calculator set to line 7, when you loaded the 1PSE 1, program memory was
alte red ...
When you inserted an instruction in the program, al! instructions after the one inserted are
moved down . Note that if you begin adding instructions and the display shows TRY AGA/N,
you should attempt to insert the instruction again. lf the display again shows TRY AGAIN,
you will need to stop and execute the 1s1ze 1 function presented in section 7, to change the
number of data storage registers. Decreasing the number of data storage registers will auto-
matically increase the size of program memory . For further explanation , refer to section 7.
Whether the calc ulator is set to PRGM mode or normal mode, when you press laTOl0
nnn , the calculator immediately jumps to the program memory line number specified by
the three-digit number nnn . Rememberl GTOl0 nnn always goes to the line number of the
curren! program. Ifthe calculator is not already within the boundary ofthe desired program,
you can easily set it to that program by pressing [GTol 0 and specifying the program name
(e.g., . jGTOl0 I ALPHA l AREA 1ALPHA l).
Let's use IGTOJ0 nnn to set the calculator to line 015. We will inserta ( PSE 1 instruction
after that line to review the contents of the X-register (which is, at that time, the area of the
cylinde r without the top and bottom).
Keystrokes Display
. jGTOl0 015 15 * Line 15 of AREA .
lxeol 16 XEQ __
1 ALPHA l PSE 1 ALPHA l 16 PSE The IPSEJ instruction.
When you added the ( PSE 1 instruction, the program was altered ...
Program Editing 135
In the HP-4ICV (or in the HP-4IC when enhanced with memory module
extensions), to go to a line number of 1,000 or greater, press 1EEX 1in place of the
thousands digit. You then key in the three remaining digits of the line number. For
example, to go to Ji ne l ,540 of an l ,800 line program, simply press 1 GTO 1O1 EEX 1
540.
Specifying a line number forl GTo] GJ that is larger than the current program will simply set
the calculator to the 1END1 of that program.
Keystrokes Display
IPAGM I 29,587. 1684 Takes the HP-4 1C ou t of PRGM
mode. The displayed number
rema ins from the previous example.
78 IENTERt 1 78.0000 The h value.
14 14 _ The r value.
1AREA I (1 LOG I) 1,231.5043 After reviewi ng the X-register
6,861.2384 contents two times during the run-
8,092.7427 ning program (first to di splay the
area of the cylinder ends, and then
to display the area of the cy linder
wi thout the ends), the answer in
square inches is displayed.
Now run the program again for a height of 2 .2789 meters and radius of O. 397 meter. (The
final answer is 6.6748 square meters.)
For example , if you wanted to modify AREA agai n so that onl y the final answer is
disp layed, you would first delete the 1PSE1 instruction that is in line 8.
Keystrokes Display
IPRGM ) 00 REG 38 Places the HP-41C into PRGM
mode .
(GrojGJ 008 08 PSE Sets the HP-41C to line 8, the loca-
tion of th e first 1PSE1 (pause).
EJ Line 8 is deleted and the calc ulator
moves up to line 7 .
You can use 1ssr1 to see th at the l PSE 1 was de le ted and a li subsequent lines were moved up.
When you set the HP-41C to fine 8 and pressed 8 to defete the (PSEI, the program was
altered ...
Keystrokes Display
(Grol c:J 015 15 PSE
EJ 14* The 1PSE1 is defeted from fine 15 and
the HP-4 1C di spfays fine f4 . Sub-
sequent instructions move up.
8,092.7427 Takes the HP-41C out of
PRGM mode.
Run AREA in USER mode (press ( LOG 1) for two cylindrical water heaters with the
following dimensions:
1.329 meters (h), 0.4811 meter (r).
(Answer: 5.4716 square me ters.)
17.24 feet (h), 9 feet (r).
(Answer: 1,483 .8370 square feet. )
In the HP-4f C is another editing function that allows you to defete fines from your pro-
grams . This functio n is 1DEL1 (delete lines). When you execute 1DEL1, the HP-41 e prompts
you for a three-dig it fine number like this: DEL ___ _ This three-digit number specifies a
138 Program Editing
number of lines to delete from the current program (the program that the calculator is cur-
rently positioned to). The calculator deletes the specified number of lines beginning at the
current positio n in the program. 1DEL1 operates only in PRGM mode.
So, if you have a 40-line program and you wish to delete 16 lines beginning w ith line 6, you
would first set the calculator to line 6 of the program. Then you would exec ute 1DEL 1 and
specify O16 to delete 16 lines. With the calculator set to line 6 o f our imag inary program,
1DEL 1 O16 would change the program ... .
... from this ... ... to this.
00 ... 00
01 LBLTBEGIN - - - - 01 LBLTBEGIN
02 02
03 03
04 04
05 RTN 05 RTN
06 LBL 01 } , 06 LBL 02
With the calculator set to line 6, 07 07
1DEL 1 O16 wou ld delete 16 lines. :
{
21 RTN
22 LBL 02
23
40 END
The 1DEL 1 fun cti on wi ll not de Jete lines beyond an 1END1 ins truction. For example, if you
execute l DEL 1 and specify 040 lines, and there are less than 40 lines in the prog ram, the
calc ul ato r will only delete up to but not including the 1END1 instructio n .
With the calculator set to line 6 of o ur imaginary program, 1DEL1 040 would change the
program ...
... from this ... ... to this.
00 00
01 LBLTBEG/N ----"~ 01 LBLTBEGIN
02 ... 02
03 03
04 ... 04
05 RTN 05 RTN
06 LBL 02 06 END
07
1DEL 1 040 would only delete up
08
to but not including the 1END1 .
09
10
24 END
Program Ed1ting 139
1DEL 1 ne ver deletes more lines than you have in a program (providing the program is
terminated with an 1END1 ) and never deletes more lines than there are allocated to program
memory .
Correcting lnstructions
You can a lso use E3 to correct keystroke errors while you are keying in instructions of
your programs. In fact, E3 works just the same in PRGM mode as it does when you are
working problems and keying in numbers and ALPHAs in normal mode.
When you make an error while you are keying in a program instruction, simply press E3
in PRGM mode. Your Iast keystroke will be deleted .
For example, set the calculator back to line 14 and insert a 1PSE1 instruction (not ice the
keystroke e rror):
Keystrokes Display
56 IENTER l 56.0000
12 12 _
1AAEA l (1 LOO l ) 4 ,222.3005 Intermediate answer.
5,127.0792
. jCLX) 0.0000
luseR I 0.0000
140 Program Editing
LBLTCIRCLE
END
LBLTAREA
END
eENDe REG 38 (This is the permanent 1END 1 in
program memory.)
Except for the local la beis A through J anda through e (refer to page 110, The Beginning of a P rogram).
When a program in the calcula to r includes an END, but has either no la beis or a li local labels, o nly the
END will appear in the lcATALOG I l listing.
Program Editing 141
By pressing 1R/S1 as the listing of ICArALOGI 1 was in progress , you could stop the listing
and the calculator would be positioned to the la bel or END displayed. Yo u could then press
1ssr 1 or 1esr 1 to Iocate and position the calculator to the desired program in program
memory.
l. Any time you execute 1CLP 1(clear program), program memory is packed.
2. Any time you attempt to inserta line into a progra m when there is not enou gh room in
program memory, program memory is packed. When the pac king is complete, the
calcul ato r will display TRY AGAIN and you shou ld reinput the des ired line.
3. When you press IGrolc:Jc:J program memory wi ll be packed. lf the re is still not
enough room in program me mory to insert an 1ENO1 , the calculato r will di splay TRY
AGAIN. There is now not enough room in program memory for any more instructions
and you should change the program memory allocation before you continue.
4. Any ti me you attempt to assig n an HP-4 IC fu nctio n to a key using 1ASN I, and there is
not enough room in program me mory for the HP-41 C to record the ass ig nment , pro-
gra m memory wi ll be packed. Whe n the pack is comple te , the HP-41 C will display
TRY AGAIN and you should again press the keys necessary to assign the function to a
key.
You can cause program me mo ry to be packed at any t ime by executing the 1PACK 1 function.
( I PACK 1 is not programmable .)
A typical pack wi ll take a few seconds. During this time, the display w ill showPACKING
The result of pack ing memory is that the programs w ill run faster afte r packing.
Problems
1. The follow ing program calc ulates the time it takes an o bject to fa ll to the earth when
dropped from a given hei ght. (Friction from the air is not taken into account. ) Whe n
the program is initialized by keying in the height hin mete rs into the X-register and
the program is executed, the time t in seconds the object takes to fall to earth is
computed according to the formu la:
t = V 2h/9.s
142 Program Editing
a. Press IGrol 8 8 to set the calculator to the end of program memory and
load the program.
00
01 LBLTFALL
02 2
03*
04 9.8
05 I
06 SQRT
07 END
c. Alter the program to compute the time of deseen! when the height in feet is
known , according to the formula:
1 =V 2h/32.174
d. Run the altered program to compute the time taken for a stone to fall from the
top of the 550-foot high Grand Coulee Dam and a coin from the top of the
607-foot high Space Needle in Seattle, Washington .
(Answers: 5.8471 seconds; 6.1427 seconds.)
143
Program Interruptions
In your prog rams, there may o ften be occasions whe n you want to ha lt exec ution so that you
can key in data, or to pause so that you can quickl y view res ults before the program auto-
matically re sumes . This sectio n shows you how to use 1STOP1 and ( PSE 1 for program inte r-
ruptio ns , as well a s how the ke yboard can be used to stop exec utio n w ith ( R/ S 1, and how an
error can halt a running program.
T he 1STOP 1 function can be placed into a program as an instructio n by pressing the (R/S 1
(runlstop) key o r by using 1xea 1 and spe lling the na me (STOP). When executed in the
program , the 1STOP1 stops program execution after its line of program me mory.
T he 1R/ S1 fu nction is o nly a keyboard functio n, that is , it cannot be recorded asan instruc-
tion in a program. However, when you pre ss the ( R/ S 1 key in PRGM mode , a 1STOP1
instructio n is recorded in the program. Whe n you press the 1R/ S1 key and the calculato r is
not in PRGM mode:
When using 1R/ S1 to halt a running program, reme mber that o nly the 1R / S1 key location in
the lower right-hand positio n of the keyboard , performs the run/stop function . T hi s is true
even in USER mode, regardless of where 1STOP1 is assig ned o r whic h functio n is assigned
to that locatio n.
Example: The fo llowing program calculate s the volume of a sphere given its radius. The
program stops execution (with 1STOP 1) to Jet you key in the value of the radius of the sphere .
T he formula for finding the vol u me of a sphere is V = (47Tr3) -:-3 .
145
146 Program lnterrupt1ons
Keystrokes Display
1 ~1 Sets the HP-4 1C to PRGM mode.
IGTOIGJGJ 00 REG 40 Sets the HP-4 1C to the end of
program memory .
ILBLI 01LBL_ _
1ALPHA 1 SPHERE 1ALPHA 1 01 LBLT SPHERE The program name, SPHERE.
lcLXI 02 cu Clears the X-register.
IR/SI 03 STOP Stops to key in the radius of the
sphere.
3 04 3 _ Places 3 into X. This value pushes
the radius into the Y-register.
-~
05 YjX Computes r3.
0 06 PI The value of pi .
0 07 * Multiplies r3 by 7T.
4 08 4 _
0 09 * Multiplies 7Tr3 by 4 .
3 10 3 _
G 11 / Divides 47Tr3 by 3.
IGTOIG]GJ 00 REG 37 Ends the program.
IPRGMI 0.0000
Keystrokes Display
. IASNI ASN _
1ALPHA 1 SPHERE 1ALPHA1 ASN SPHERE _
@ 0.0000
Keystrokes Display
luSERI 0.0000
ISPHEREI (@]) 0.0000 The program stops so you can key in
the radius of the sphere.
21.22 21.22 _ The radius of the spherical balloon.
In the next section (secti on 10), you wi ll see how ALPHA strings can be used to make
prompting for data simple-your programs can actually ask you for data.
Keyboard Stops
As you know , pressing 1R / S1 from the keyboard during a running program halts that
program. The program may halt after any line -if you set the calculator to PRGM mode
after a program is halted, you will see the li ne number and the instruction of the next line to
be executed.
148 Program lnterruptions
When a program is ha lted, you can resume execut ion by pressi ng 1R/S1 from the keyboard
in normal mode. When you press 1R/S1, the program begins execut ion with the next lineas
tho ug h it had never sto pped at ali.
Error Stops
lf the HP-4 1C attempts to execute any e rror-causing o pe ration during a running program,
execution halts and the HP-4 1C displays an error message. Fo r example , if a program
attempts divisio n by zero. the calculato r dis plays DATA ERROR. lf the program calculates a
number too large for the calculator to handle, the HP-41 C di splays OUT OF RANGE.
To see the line in the prog ram cont ain ing the error-causing instructi on , briefly set the
calc ul ator to PRGM mode . Settin g the HP-4 1C to PRGM mode clears the e rro r, as does
pres~ ing B . Yo u can the n make the necessary changes to e nsure proper exec ution .
The HP-4 1C has several func tio ns that allow you to control how the calculator reacts to
these and other errors. Section 14 o f th is hand book covers these error conditions in detail.
Problem
1. For severa! different sizes of cans, the super-
visor ata canning company knows the radius r
of the base of the can , the he ight h of the c an ,
and n , the numberof caos ofthat size. Write a
program that will sto p for the supervisor to
key in the radius, the he ight, and the number
of cans. The program should calculate the
base area of o ne can , the volume of o ne can ,
and the total volume of ali o f the cans. Use
1PSE1 instructio ns to display the area and
volume of the single cans before the to ta l
volume is displayed .
Use the fo llow ing fl owchart to help you write and load the program. Assign the
program to the 1TAN1 key locat ion and run the progra m for 20,000 caos w ith heights
of 25 centime te rs and radii of JO ce ntimeters; for 7500 caos with heights of 8
centimeters and rad ii of 4 .5 centime te rs.
(Answers:
A = 3 14 . 1593 c m2
V = 7,853.98 16 c m3
Total Volume = 157,079,632.7 c m3
A = 63.6 173 cm 2
V = 508 .9380 cm 3
Total Volume = 3,8 17 ,035 .074 c m3 .)
Program lnterruptions 149
Calculate A = 7Tr2
Pause to display A
Calculate V= A x h
Pause to display V
One of the greatest utilizations of the HP-4.J C ALPHA capability is in programs that you
write. ALPHA strings (a series of ALPHA characters) in your programs can prompt you
for information, inform you of the status of a program and even label output. This section
shows you how to use ALPHA strings in your programs.
Prompting
There are severa) ways to use ALPHA strings in your programs to prompt for data input.
Prompts in your programs are a simple way to assure that you input the correct data value.
Or you can use prompts to simply display messages.
The easiest way to use prompts is with the IPA<>MPTI funct ion . The IPA<>MPTI instruction in a
program displays the contents ofthe ALPHA registerand stops program execution . Simply
key in the ALPHA string as a line in the program and follow it with IPA<>MPTI . Execution
will halt and the display will show the prompt string.
151
152 Programming with ALPHA Strings
Another way to use prompt is to use 1ARCL1 to recall a string from a register and then use
IPROM>TI to halt program execution and di splay the prompt string. Thi s method requires you
to store the AL PH A string into a register for later use as a prompt string. You can either store
thi s string before you e xecute the program or you can instruct the program to store the string.
Refer to section 5 of part 1 for more information about 1ARCL1 .
Example: The following program prompts for a number, stops for the input, then com-
putes the common logarithm of the nu.mber. The ALPHA prompt is a line in the program
and is placed into the di splay with IPROM>Tl .
Keystrokes Display
IPRGMI
. (GrolGJGJ 00 REG 37
. I LBL J
1 ALPHA 1 CLOG 1 ALPHA 1 01 LBLTCLOG The program na me, CLOG.
1 ALPHA 1 NUMBER? 1 ALPHA1 02TNUMBER? The prompt string.
lxrnl
1 ALPHA 1 PROMPT 1 ALPHA 1 03 PROMPT Displays the ALPHA register and
stops for data input.
1LOGI 04 LOG The common logarithm .
IGTolGJGJ 00 REG 34
Keystrokes Display
IPl'IGM 1 0.0000 Takes the HP-41C o ut of PRGM
mode.
lxrnl
1 ALPHA 1 CLOG 1 ALPHA 1 NUMBER? The prompt.
8 8_ The number.
IRtSI 0.9031 The log of 8.
. ICLXJ 0.0000
Prompting can also be accomplished using 1AVIEW1 (ALPHA view) and 1STOP1 in a pro-
gram. The 1 AVIEW 1 displays the contents of the ALPHA register and the 1STOP1 halts pro-
gram execution.
Labeling Data
Data labeling can be quite useful to the output your progra ms produce. Labeled o utput
leaves no doubt as to which result is displayed. Data can be labeled with ALPHA strings
using 1ASTO1 ' 1ARCL1 and 1 AVIEW 1. To label output:
Programming with ALPHA Strings 153
Note: Care must be used in labeling data in programs because information re-
quiring more space than is available in the display will be scrolled off the display
to the left.
Example: The following is a modification of CLOG (from above) that labels the output
from the program . Begin by clearing CLOG from progra m memory and create a new
ve rsion of the program.
Keystrokes Display
IXEO J XEQ __
1ALPHA 1 CLP 1 ALPHA 1 CLP _
1ALPHA 1 CLOG 1ALPHA 1 0.0000 Clears CLOG from progra m
memory.
IPRGMI
1Grolc::J8 00 REG 37
. ILBL J
1ALPHA J LOG 1 1ALPHA1 01 LBLTLOG1 The new program name .
1ALPHA J NUMBER? 1 ALPHA J 02TNUMBER? The prompt fo r in put.
lxEOJ
1 ALPHA 1 PROMPT 1 ALPHA 1 03 PROMPT Displays the prompt and stops for
the data input.
!LOGJ 04 LOG The common logarithm.
1 ALPHA 1 LOG = OSTLOG =_ The data la bel .
. IAACLJGJ X 06 ARCL X This recalls the result from the X -
register and places it into the
ALPHA register along with its
curren! contents, LOG = .
07 AVIEW This displays the contents of the
ALPHA register (which is now
LOG = and the logarithm result).
00 REG 33
154 Programming with ALPHA Strings
Now run the LOG 1 program to ftnd the Jog of 12. Notice how the progra m first prompts
you for the number. then la beis the output.
Keystrokes Display
IPRGMI 0.0000 Takes the HP-41C out of PRGM
mode. Number re mains from
previous exam ple .
lxEol XEQ __
1 ALPHA l LQG . 1 1ALPHA1 NUMBER? The prompt for the number.
12 12 The number.
~ LOG = 1.0792 The data !abe! and the data.
lcLxl 0.0000
Data labe ling can also be accomplished by recalling (using 1ARCL1 ) the ALPHA string from
a register, and then the result from the X-register (also using 1ARCL1 ).
Program Status
To de tect the status of you r executi ng progra m, you can place ALPHA strings in strategic
places in your programs. When the string is displayed mo mentaril y, you know exactly how
far execution has progressed .
Here is an example of how 1ASHF 1can be used . The program stores a string of c harac ters into
several reg isters and the n recalls the sto red strings one at a time into the di splay. Begin by
assigning 1ASHF 1 to the 1TAN1 key for use in USER mode.
Keystrokes Display
. , ASN J ASN _
1ALPHA 1 ASHF 1ALPHA 1 ASN ASHF ..:.
ITANJ ASN ASHF 25
0.0000
0.0000
Keystrokes Display
IPRGM J
(GToJG:JG:J 00 REG 32
. I LBL J
1ALPHA J SH IFTY i ALPHA J 01 LBLT SH/FTY
1ALPHA J SUNDAYMONDAY UNDAYMONDAY -
. ,ASTO J 0 1 03 ASTO 01 The first six characte rs are stored
into R 0 1.
1ALPHA J
1ASHF J (1 TAN J) 04 ASHF Six charac te rs are shifted o ff to the
le ft .
i ALPHA J
. , ASTO J 02 05 ASTO 02 The second six characters are stored
into R 02 .
,CLA J 06 CLA ALPHA register is cleared .
. , ARCLJ 01 07 ARCL 01 Recall the six c haracters stored into
R o1
, AVIEW I 08 AVIEW Di splay the string .
i ALPHA J
lxeaJ
1ALPHA 1 PSE 1ALPHA 1 09PSE Pause.
1 ALPHA J . ICLAJ 10 CLA ALPHA register is cleared .
. ,ARCL J 02 11ARCL02 Recall the six characters stored into
R02 .
, AVIEW J 12 AVIEW Display the string.
i ALPHA J
. ,GTOJ G:)G:) 00 REG 26 The end of the program.
156 Programming with ALPHA Strings
Run the program and watch how the strings are displayed .
Keystrokes Display
1USER 11 Pf!GM1 0.0000
lxEa l
1ALPHA 1 SHIFTY 1ALPHA1 SUNDAY
MONDA Y
Problem:
1. The follow ing program computes the total
price, tax , and final cost of items on a billing
in voice. Rew rit e the program and insert
ALPH A strings and !PAOtoFTI for the quantity,
unit price and tax . In addition, insert an
ALPHA string to label the output of the final
amount (recall the fin al amount from the
X-reg ister into the ALPHA register usi ng
1ARCL18 X. Run the program for 26 ruby
rings that cost $72. 90 with a tax of7 .25%; for
11 shovels that cost $7. 15 with a 5% tax .
lnsert these strings into the program to prompt for data: QUANT? (qu antity), PRICE?
(un it pri ce), TAX? (tax rate). Store this string in storage register R 111 (wi th 1ASTO 1) and
reca ll it (with 1ARCl 1) in the program to label the output: TOT - $. lf you have trouble
with this problem, you may wish to review this secti on before you continue.
(Answers: TOT =$ 2032.82; TOT =$ 82. 58.)
O 1 L IJL -, /3 i I 1 I
Here is what a !GTOI branch would do if a prog ram in the HP-4 1C looked like this:
Execution
1
LBLTTEST
Execution branches to the next
1LBL1 01 in the program. GTO 01
~---.---- LBL 01
When the program encounters thelGTol 0 1 instruction, execution immediately halls and the
calculator searches sequentially downward through the program for the first occurrence of a
1LBL1 O1. If the calculator does not find a 1L BL1 O1 before reaching the end of the program
(an 1END1 instruction), the calculator starts searching from the top of the program until it
finds the 1LBL1 O1. If the Ja bel does not exist, the HP-41 C will display NONEXISTENT and
the calculator will be positioned to the same line it was set to prior to beginning the search.
Press 8 to clear the error.
159
160 Branching and Looping
You may wish to clear sorne of the programs you ha ve recorded in program memory so that
you will have room to include the problems in this and following sections. Check ~
1 to see the names of the programs and delete the ones you don ' t wish to save using 1CLP1
(clear program) . You can clear any key assignments by pressing . IAsNll ALPHA 11ALPHA1
and the reassigned key. Subsequent problems in the handbook assume that program mem-
ory has been cleared of ali programs and no key assignments have been made.
Name the program ROOT and assign it to the ITANI key location .
Keystrokes Display
IPRGMl . IGrolGJ GJ 00 REG 46 Sets the HP-41 C to progra m mode
and to the end of program memory .
ILBL I
1ALPHA 1 ROOT 1ALPHA 1 01 LBLTROOT The program name.
o
lsrol 01
02 -
03 STO 01 Stores O in Ro1
ILBLI 05 04 LBL 05
1 05 1-
lsrol[IJ 01 06 ST + 01 Adds 1 to lhe current number in
R,,, .
IRCLI 01 07 RCL 01 Recalls current number from R01 .
lxrnl
1ALPHA i PSE 1ALPHA1 08 PSE Displays current number.
@ 09 SQRT Computes the square root of the
number.
lxeol
1ALPHA J PSE 1ALPHA 1 10 PSE Displays square root of current
number.
. ,GTO) 05 11GTO05 Transfers execution to the 1LBL1 05
in line 4.
00 REG 43
Branching and Looping 161
To run the program, first assign it to the 1TAN1 key location for execution in USER mode.
Keystrokes Display
IPRGMI 0.0000
. I ASNI ASN _
1ALPHA1 ROOT 1ALPHA1 ASN ROOT _
ITNI 0.0000 ROOT is assigned to the 1TAN1
location.
0.0000 HP-4IC is placed into USER mode.
Keystrokes Display
IROOTI (ITAN I) 1.0000 The program displays a table of
1.0000 integers and their square roots and
continues until you press 1~IS1
2.0000 from the keyboard or the calculator
1.4142 overflows.
3.0000
1.7321
4 .0000
2.0000
5.0000
2.2361
How the program works: When you press IRoorl , the calculator begins executing the
ROOT program starting with line 1. It executes that instruction and each subsequent instruc-
tion in arder until it reaches the !Grol 05 in line 11 .
The IGrol 05 in Iine 11 causes the HP-41 C to begin a labe l search . lt searches downward
through the program to the 1END 1 instruction, then .starts at the beg inning of the program
(line O) and searches downward until it finds the i LBL 1 05 in line 4. Notice that the address
after the IGrol instruction is a numeric program /abe/, not a fine .number.
Execution is transferred to the l LBL 1 05 instruction in line 4 each time the calc ulator
executes the IGrol 05 in line 11. The calculator remains in thi s ' ' loop," continually add ing
one to the number in storage register R 0 1 and display ing the new number and its square
roo t.
162 Branching and Looping
An exci ting fea ture in the HP-4IC is the calcu lator's ability to " re me m ber" where most
branches are located in a program. The HP-41 C only has to searc h fo r most la be ls the firs t
time through the program . Whe n the program bra nc hes to th at label the calculator does not
have to search agai n ! lt knows where the Iabel is located so it immed iately beg ins execution
at that line . The re sult is th at execut ion time is greatly reduced because the calculator does
no t have to repeatedl y searc h for most Iabels. This feature is known as compiling and is
generall y only found in large computer syste ms. Fo r mo re information about ho w the
HP-41 C reme mbers la beis, refer to appendix G .
00
01 LBLTROOT
02 o
03 STO 01
04 LBL 05
05 1
T he 06 ST + 01
.. infinite" 07 RCL 01
loop. 08 PSE
09 SQRT
10 PSE
11 GTO 05
12 END
Loop ing techniq ue s like the one illustrated he re are co mmon and extraordin arily usefu l in
prog ramming . By using loops , you take ad vant age o f o ne of the most powe rful features of
the calculator- the ability to update data and perform calcul ati o ns auto matically , qu ickl y,
and , if you so des ire, endlessly.
You can use unco nditi onal branc hes to c reate a loop , as s ho wn above, o r in any part of a
progra m where you wish to transfer exec utio n to ano the r la be l. When the calcul ato r exe-
c utes a l crol instruction , it searc hes seque ntia lly thro ug h the program a nd begins execut ion
at the first speci fi ed labe l it enco unters .
Problems
1. T he fo llo wing progra m computes x = 2 n sin(90-:- n). Modi fy this prog ra m by plac ing a
1LBL 1 O1 instructi on in line 4 , and these instructio ns at the end of the program Uust
before the 1END1 ):
PSE
10
ST*OO
GTO 01
Branching and Looping 163
The modificati on creates an infinite loop in the prog ra m; it now computes an infin ite
series of numbers that approaches the value of pi . Run the program and watch the
va lues as they approach rr. Set the calc ulator to [IIKJ 9 so you can see the complete
di splay.
00
01 LBLTPIFIND
021 Insert al LBL l 0 1 afterthis
03 STO OO . . - - - - - instruction.
04 90
05 RCL 00
06 /
07 SIN
08 RC
~L 00 Inse rt these instruc tio ns at the e nd of
09 * the program:
10 2 PSE
11 * 10
12 END ST*OO
GTO 01
Controlled Looping
The HP-4 1C has two powerful functions that make looping in your programs very easy.
These functions are~ (increment and skip if greater) and 1ose1 (decrement and skip if
equa/). Both functions contain intern a! counters that allow you to control the execution of
the loop.
These two funct ions JJSe a number th at is interpreted in a special way to control prog ram
loops. The number is stored into any storage register (even the stack). The format of the
number is:
iiiii.fffcc
where
The iiiii portion o f the number tells the HP-41 C that you wish to count the number of passes
through the loop beginning with that number. If you do no t specify an iiiii value, the HP-4IC
assumes you wish to begin counting at zero . An iiiii value can be s pecified as one to five
digits.
The fff portion of the number te lls the HP-41 C that you wish to stop the counting at that
number. The fff value must always be specified as a three-digit number (e.g., an fff value of
10 would be spec ified as 010). If you do not specify an fff value, the HP-4I C assumes you
wish to stop counting at zero.
164 Branch1ng and Looping
The ce portion of the number te lls the calculator how you w ish to count. Current counter
value iiii is incremented or decreme nted by the increment value of ce . lf you do not specify
a ce value, the HP-41C assumes you wish to count by ones (cc = Ol ). A ce value must be
specified as two digits (e.g., O1, 03, 55).
Remember, in a program when the final value is obtai ned, the HP-41 C skips the next fine in
the program . You will see how this is useful later.
Branching and Looping 165
lf you execute 1ose1 from the keyboa~d , it si mply decrements the specified regi ster just like
it would in a program.
Example: Here is a program that illustrates how l 1sG 1 works. It contains a loop that pauses
to display the current value in register Ro, displays the square of that number, and uses
I SG 1 to control the number of passes through the loop and the value of the squared number.
The program generates a table of squares of even numbers from 2 through 50.
Keystrokes Display
IPRGMI
. ,GTOl88 00 REG 46
. I LBL I
1ALPHA 1 EVENS 1ALPHA 1 01 LBLT EVENS The program name , EVENS.
2.05002 02 2.05002 _ The loop control number. Beginning
with 2 , increments up to 50 by twos.
Tests each execution to see if the
counter is greater than 50.
lsro l 01 03 STO 01 Stores the loop control number in
Ro1
. , LBL I 01 04 LBL 01 Begins the loop.
IRCLI 01 05 RCL 01 Recalls the number in R 01 .
xea l
1ALPHA 1 INT 1ALPHA1 06 INT Takes the integer portion of the
number.
lxea l
1ALPHA 1 PSE 1ALPHA 1 07 PSE Displays the integer portion of the
number.
50.0000
2,500.0000
Example: The island of Manh attan was sold in the year 1624 fo r $24.00. The program
below shows how the amount would have grown each year if the original amount had been
placed in a bank account draw ing 6% interest compounded annua lly . The program prom pts
for the number of years and alters that number for use byl ose 1 . The lose 1 is used to control
the number of iterations through the loop.
Keystrokes: Display:
1 14 1-
l sr o l (] 01 15 ST + 01
l xEo l
1 ALPHA 1 OSE 1 ALPHA 1 00 16 DSE 00 The loop control number i s stored in
R 00 The coun_ter test value (fff ) i s
zero and the decrement value (ce) is
0 1. W hen iiiii reaches zero, the next
line in the program is skipped. U ntil
t hen, the program loops bac k to
ILBLJ 01.
. ,GTOl 01 17 GTO 01 The end of th e loop.
IRCLl 01 18 RCL 01 Recalls the year.
tI!Il o 19 FIX O
I XEOl
1 ALPHA 1 PSE 1 ALPHA 1 20 PSE Pauses to display the year.
tI!Il 2 21 FIX 2
IRcLI 02 22 RCL 02 Recalls the final amount.
. (GTOl00 00 REG 39
Now run the program to find the amount in the savings account after 6 years; after 355 years.
(This will take a couple of m inutes to run, ti me enough to take a short break .)
Keystrokes Display
IPRGM I 0.0000 T akes the HP-4 1C out of PRGM
mode.
lxEol
i ALPHA l GOTHAM i ALPHA l YEARS? The program prompts and stops for
input.
6 1R/ S J 1,630 After 6 years , in 1630, the account
34.04 wou ld have been worth $34.04.
IXEOI
1 ALPHA 1 GOTHAM 1 ALPHA 1 YEARS?
355 I Rtsi 1,979
2.31 10 After 355 years, in 1979, the
account would be worth about
$23. J billion .
iCLxj 0.00
(I!I) 4 0.0000 Retum s to tI!Il 4.
168 Branching and Looping
How it works: Each time you execute GOTHAM , the program prompts you forthe number
of years , which is stored in R00 . This is used by the 1OSE1 as the loop control value. The
year ( 1624) is stored in R01 and the initial amount is stored in R02
Each time through the loop, 6% of the amount is computed and added to the amount in R02
and 1 year is added to the year in R0 1 . The 1OSE1 subtracts one from the R00-register; if the
value in Roo is not then zero, execution is transferred back to 1LBL1 O1, and the loop is
executed again .
When R00 becomes zero , execution skips to the IRCLI 01 instruction in line 18. The year is
then recalled and displayed (formatted in 1II!J 0) , and the final amo unt is recalled and
displayed (formatted in 1II!J 2) .
Note that l 1sG 1 and 1ose1 can be used to increment and decrement any number that the
HP-41 C can display. However, the decimal portion of the control number will be affected
by large numbers.
For example, the number 99,950.50055, when incremented by 55 using l 1sGI would be-
come 100,005.5005 . The initial numberwas incremented by 55. But since the new number
cannot be fully displayed , the decimal portion of the number was truncated. The next in-
crement would be by 50, not 55 . And when the number becomes 999,955 .5005, the next
number would be 1,000,005 .500, thus truncating the decimal portion of the number again.
Since no increment value is present, the next increment would be by 01 , not 50.
Problem:
1. Write a program that will count from zero up to a limit using the l 1sG 1 function , and
then, in the same program, count back down to zero using the losEI function . The
program should contain two loops, the first one counting up, the second one counting
down. Use the flowchart on the follow ing page to help you.
Branching and Looping 169
Recall R.,.
Take integer
portion of R05
Pause to
display R06
No
STOR05
Recall Ros
Take integer
portion of R05
No
170 Branching and Looping
Prompt for
income amount
Stop to key in
income amount
Yes No
Compute Compute
22% of income 17.5% of income
Display tax
tests to see if the value in the X-register is equal to the value in the
Y-register.
tests to see if the value in the X-register is equal to zero.
Branching and Looping 171
tests to see if the value in the X-register is greater than the value in the
Y-register.
tests to see if the value in the X-register is greater than zero.
tests to see if the value in the X-register is less than the value in the
Y-reg ister.
tests to see if the value in the X-register is less tha n zero.
tests to see if the value in the X-register is less th an or eq ual to the value
in the Y-register. Display execution form is 1X<=Y?1 .
tests to see if the value in the X-reg ister is less than or equal to zero .
tests to see if the value in the X-register is not equal to the value in the
Y-register.
tests to see if the value in the X-register is not equal to zero.
(To access the >. <.=, and =f symbols on the HP-41 C keyboard, refer to the label on
the back ofthe calculator orto page 18, The ALPHA keyboard.)
Two of these condition als, lx=Y?) a nd 1X"Y?I can be used to compare ALPHA strings as
well as numbers. Ali of the other conditionals compare onl y numbers. If t wo strings are
"equal" (I X=v?I), then they are exactly equal in length and have identical characters.
Each conditional essentially asks a questi on when it is encountered as an instruction in a
program. lf the answer is YES , program execution continues sequentiall y downward with
the next instruction in program me mory. lf the answer is NO, the calculator branches
around the next instruction .
(Whe n you execute any of these conditionals manually from the keyboard, the HP-41 C
displays the answer to the conditional question . lf the condition is true the di splay shows
YES. lf the conditional is false, the di splay shows NO.)
In other words , the calc ulator will do the ne xt line if the test is true. This is the " DO IF
TRUE" rule .
For example:
Execution
'
Yes 1
.. Conditional Tes t
: J No
The line immediate ly following the conditiona l test can contain a ny instruction. The most
commonly used instruction will be a !Grol instruction . This will branc h program execution
to another section of program memory if the conditional test is true . For example:
172 Branching and Looping
e
1
GT002 : J NO
lnstruction
lnstruction
LBL 02
+ lnstruction 1
Now let's look at that tax accountant 's problem agai n. For persons with incomes of more
than $10,000 the program should compute a tax of 22%. For persons with income of
$10,000 or less the taxis 17.5%. The following program will test the amount in the X-
register and compute and display the correct tax amount.
Keystrokes Display
IPRGMJ
. IGTOJG::)G::) 00 REG 46
. ILBLJ
1ALPHA J TAX i ALPHA J 01 LBLTTAX The program name.
1ALPHA J INCOME? 1 ALPHA J 02T/NCOME? Prompts for income.
lxeal
1ALPHA J PROMPT i ALPHA J 03 PROMPT Displays prompt and halts execution
so you can key in the income.
10000 04 10000_
lx~YJ 05 X <>Y Amount of $ 10,000 put in
Y -register .
,X>Y?J 06 X > Y? Conditional test. If income is
greater than $10,000, does the next
line in the program. If not, skips
the next line.
IGTOJ 02 07 GTO 02 Branch to ILBLJ 02 .
17.5 08 17.5- Tax rate (income less than $ 10,000).
,GTOJ 03 09 GTO 03 Branch to 1LBL1 03 .
. ILBLJ02 10 LBL 02
22 11 22 _ Tax rate (incomes more than
$10,000) .
,LBLJ 03 12 LBL 03
oo 13 % Computes the tax .
IGTOJG::)G::) 00 REG 41
Branch1ng and Looping 173
Problems:
1. Write a program that will calculate the are sine (that is, si n- 1 ) of a value that has been
keyed into the X-register. Test the resulting angle with a conditional, and if it is nega-
tive or zero, add 360 degrees to make the angle posi tive. Use the flowchart below to
help you write the program .
Run the program to find the are sine of - 0.7 and 0.5.
(Answers: 315.5730 and 30.0000.)
Calculate are
sine of x
Yes No
Multiply by Ro3
Store in R02
Label output
Recall mileage & and display cost
divide by 350
175
Often , a program contains a certain series of instructions that are executed several times in
severa! places in a program . Ora program requires a set of instructions that are included in
another program. These instructions can be executed by a programas a subroutine . A sub-
routine is selected and executed in a program by the 1XEO1 ( execute) function. Using 1xEa I,
you can select either ALPHA labeled or numeric labeled subroutines.
In a progra m, 1xEa 1 transfers exec ution to the program label spec ified by the 1xEal function .
Afte r the subroutine has been e xecuted, and the running program executes an 1END1 or
1RTN 1, execution is transferred back to the main progra m. Execution the n continues with the
nex t instruction after the 1XEO1 and sequentiall y down through the program. Note that a
IGrol merely transfen. exec ution to the spec ified labe l but does not retum execution to the
main program. The illustration below should make clear the di stinction be twee n IGrol and
lxEOI .
Branch Subroutine
LBLTTEST ~ LBL 01 LBLTTEST LBL 01
GTt
+
RTN
01 1
'
RTN
l
RTN
Execution Execution
stops here. stops here.
In the illustration of a branch , on the left, if you ran program TEST, the program would
execute instructions sequentially downward through program memory. When it encoun-
tered the lorol 01 instruction, it would then search for the next ILBLI 01 in the program,
and continue execution until it encountered an 1ENO1 or 1RTN1 . At that point, execution
would hall.
However, if you ran the TEST program on the right, the program would execute instructions
sequentially downward throug h program memory until it encountered the lxEal 01 instruc-
tion . It would then search for the next 1LBL1 O1 in the program , and then continue execution
there. Whe n it encountered an IRrNI , program execution would be transferred again, this
time back to the main program. It would then resume with the next instruction after the
lxEal 01.
177
178 Subroutines
As you can see, the onl y difference between a subroutine and a no rmal branch is the
cransfer of execution afrer the 1END1 or 1RTN1 . After the !Gro! , the next 1END 1 or 1RTN 1 halts
a runn ing program. After an 1xeo 1, the next 1END 1 orl RTN 1 retums execution back to the
main program. where ic continues until another IENol or IRrN I is encountered .
1. Numeric labels and local ALPHA labels (A through J and a through e, more about
these later) are used for programs and subroutines inside the program file. The cal-
culator searches for these labels inside the current program file only.
Searches for numeric labels and local ALPHA labels begin at the current position in a
program and progress downward through the program to the first 1END1 . If the label is
not found, searching begins at the beginning of the program file and downward to
where the search began. If the !abe! is still not found, the display will show
NONEX/STENT.
Programs and subroutines inside program files are usually terminated with 1RTN1 .
This is because the main program file that they are part of has its own beginning !abe!
and ends with an 1END 1. However, if the subroutine is at the end of the program file ,
the 1END 1 of the program file will suffice to al so end the subroutine.
2. Programs wi th ALPHA labels are generally used for programs and subrout ines
ourside other programs. The calcul ato r searches ali of program memory for ALPHA
labe ls. The ALPHA label search beg ins with the /asr ALPHA label in program mem-
ory and upward through ali of the ALPHA labels in program memory. If the label is
not fou nd . the display wi ll show NONEXISTENT.
Programs and subro utines outside program files are usually terminated with 1END 1 .
This is because they must stand alone as separate programs in program memory.
Note chat severa! subroutines or subprograms can be grouped together as a si ng le
'' program. Ali but the fin al routine sho uld be terminated with 1RTN1 instructions.
The final routine should be terminated with 1ENO1 . In thi s case, each of these subrou-
tines can be labe led with ALPHA labels.
Subroutines 179
XE~ 01
[
XEQ01
[
,:~0 RTN
LBL 01
This subroutine has a
numeric label. Because
RT~}J
This subroutine has a
numeric label and is it is at the end of the
terminated with 1RTN 1. END - program file, it is ter-
minated with 1END 1.
END
'Sorne values of a. b, ande may result in misleading answers because their solutions require greater than 12 digits
of accuracy.
180 Subroutines
00
01 LBLTQROOT
02Ta?
03 PROMPT
04 STO 01
05Tb?
06 PROMPT
07 STO 02
08Tc?
09 PROMPT
10 STO 03
11 RCL 02 28 RCL 02
12 CHS 29 CHS
13 RCL 02 30 RCL 02
14 Xf2 31 Xf2
15 RCL 01
These sections
32 RCL 01
of prog ram
16 RCL 03 33 RCL 03
me mory are
17*
18 4
identical. 34*
35 4
19 * 36 *
20 - 37 -
21 SQRT 38 SQRT
22 - 39 +
23 RCL 01 40 RCL 01
24 2 41 2
25 * 42 *
26 / 43 I
27 PSE 44 PSE
45 END
Since the routine for c alculating r 1 contains a Ja rge sec tion that is identical to a large
section in the routi ne for ca lculating r2 , you can simply c reate a subroutine out of the dupli-
cated instructions. The s ubroutine is then exec uted in both the so lutions for r 1 and r2 This
subroutine is inside the program file. Since it occurs at the end of the program file, the
1END1 for the program file also acts as the end of the subroutine.
Subroutines 181
01 LBLTQROOT
02Ta?
03 PROMPT
04 STO 01 26 LBL 01
05Tb? 27 RCL 02
06 PROMPT 28 CHS
07 STO 02 29 RCL 02
08Tc? 30 Xt2
09 PROMPT 31 RCL 01
10 STO 03 32 RCL 03
11 XEQ 01 33*
12 - 34 4
13 RCL 01 35*
14 2 36 -
15* 37 SQRT
16 / 38 END
17 PSE
18 XEQ 01
19 +
20 RCL 01
21 2
22*
23 /
24 PSE
25 RTN
With this version of the program, execution begi ns w ith the label in line 1 and continues
until the 1xea1 O1 in line 11 . At this point, execution is transferred to the 1LBL1 O1 in line 26;
this is the beginning of the subroutine. When the 1ENO1 in line 38 is encountered, execution
is transferred back to line 12, the G instruction . Root r 1 is displayed and the program
continues.
When the 1xealO1 in line 18 is encountered, execution is transferred agai n to the 1LBL1 01 in
line 26. When the 1ENO1 in line 38 is encountered, execution tran sfers back to line 19 and
root r2 is di splayed.
The use of the subroutine saved you seven lines of program memory!
Before you key in the program , you may wish to clear other programs from program
memory. Do so by executing 1CLP1 and specifying the name of the program you wish
to clear. Remember, if you are in doubt as to what is in program memory, simply list
~l.
182 Subroutines
Keystrokes Display
[PRGMI
. [GTOl00 00 REG 46
. [LBL I
[ ALPHA 1 QRQQT [ ALPHA 1 01 LBLTQROOT
[ ALPHA 1 a? [ ALPHA 1 02Ta?
[ XEO I
[ ALPHA 1 PRQMPT [ ALPHA 1 03 PROMPT Prompts and stops for input.
[STO ! 0 1 04 STO 01
[ ALPHA 1 b? [ ALPHA 1 05Tb?
[ XEOI
1ALPHA 1 PROMPT [ ALPHA 1 06 PROMPT Prompts and sto ps for input.
[STO I 02 07 STO 02
[ ALPHA l. e? [ ALPHA 1 08Tc?
[ XEO I
[ ALPHA 1 PRQMPT [ ALPHA 1 09PROMPT Prompts and stops for input.
[STO I 03 10 STO 03
[XEO I01 11 XEQ 01
G 12 -
[RCLI 01 13 RCL 01 Calculates and pauses to display r1
2 14 2 _
0 15*
G 16 /
[XEOI
1ALPHA 1 PSE 1 ALPHA 1 17 PSE
[xEo lo 1 18 XEQ 01
G 19 +
[RCLI 0 1 20 RCL 01
2 21 2 _
0 22* Calculates and pauses to display r2
G 23 I
[ XEOI
[ ALPHA 1 PSE [ ALPHA 1 24PSE
. [RTNI 25 RTN - - -- - Final exec ution stops here.
[ LBLI 01 26 LBL 01 Beginni ng of the subroutine.
l RCLI 02 27 RCL 02
l CHSI 28 CHS
lRCLI 02 29 RCL 02
-~ 30Xt2
Subrout1nes 183
Keystrokes Display
IRcLI 01 31 RCL 01
JRCLI 03 32 RCL 03
0 33 *
4 34 4 _
0 35*
G 36 -
@ 37 SQRT End of the subroutine.
IGrol GJ GJ 00 REG 38
Run the QROOT program now to find the roots of the equation x2 +x- 6= 0(a= 1, b= ! ,
c=- 6); of 3x 2 + 2x - 1= 0 (a= 3, b= 2, c= - 1):
Keystrokes Display
JPRGMI 0.0000 Takes the HP-41 C out of PRGM
mode .
lxeal
l ALPHA 1 QROOT l ALPHA 1 a?
1 1RIS1 b?
1 1RIS1 e?
6ICHSIJR tsl -3.0000 The first root.
2.0000 The second root.
lxeal
l ALPHA 1 QROOT l ALPHA 1 a?
3l RIS1 b?
2 IR IS1 e?
1 ICHSl! RtSI -1.0000 The first root.
0.3333 The second root .
jCLxl 0.0000
Ifthe quantity b2-4ac is a negative number, the calculator will display DATA ERROR to Jet
you know that the program has attempted to find the square root of a negative number. The
program will stop running.
You can use a specific numeric label (like l LBL 1 10) any number of times in the programs
you write. When you branch to that label, the calculator finds the first occurance of that
labe l in the curren! program beginning from the present locatio n in the program. Refer to
Subroutine Types and Label Searching, page 178, for more information .
However , note that you should use caution whe n using the same ALPHA label more than
one time. Since the HP-41C searches ali of program memory from the bottom up for
ALPHA labels, only the last occurrence ofthat label in program memory will ever be found.
After the first execution of a subroutine, the HP-4 1C "remembers" the location of most
numeric labels. Subsequent branches to those labels do not require the time-consumi ng
search. Refer to appendix G for more deta ils about labe l searching.
When a program is labeled with an ALPHA label, the HP-4 1C beg ins searc hing through ali
ALPHA labels beginning at the bottom of program memory . lf the ALPHA label is not
fo und , the display will show NONEXISTENT .
Beginning with the introduction of this handbook, you have written and executed severa)
programs that relate to the heat loss of a cylindrical wate r heater. These programs included
HEAT , C IRCLE, and AREA . Let's now bring all of these progra ms togethe r and forrn o ne
master program that uses these programs to find the heat loss of the water heater. To
begin , make sure all o f these programs have been cleared from program memory because
you will make minor c hanges and re-load them . Use 1CLP1 and specify the program name to
c lear them .
You wi ll create three new programs: BTU, AREA, and TEMP. BTU is the masterprogram
that e xecutes the other programs as subroutines a nd g ives the fin al answer. AREA com-
putes the area of a cylinder given its height and radius, and TEMP computes the tempe ra-
ture difference between the heate r surface and the a ir around the heater. Since AREA and
TEMP are outside the master program, they have ALPHA labels and are terminated with
1END1 instructi ons.
Since you wi ll use IPAOllPTI so many times whe n you input the fo llowi ng programs, first
assign the IPA011PTI function to the ~ key for use in USER mode . T hen, each time you
wish to insert a !PA011PTI instruction in a progra m, simply press ~ in USER mode .
Keystrokes Display
. ( ASNI ASN _
1ALPHA1 PROMPT 1ALPHA1 ASN PROMPT _
~ 0.0000
1USER1 0.0000
Subrou tines 185
Keystrokes Display
IPRGMI
. [GTOIGJGJ 00 REG 45
ILBL I
1ALPHA 1BTU 1ALPHA 1 01 LBLTBTU The master program name.
IXEO I
i ALPHA 1TEMP 1ALPHA 1 02 XEQTTEMP Executes the TEMP program (to be
loaded later) as a subroutine.
lxEa l
1ALPHA1 AREA 1ALPHA 1 03 XEQTAREA Exec utes the AREA program (to be
loaded later) as a subroutine.
0 04 *
.47 05 .47 _ The convecti ve heat transfer
coefficient. *
0 06 * Computes the final result.
1ALPHA 1
LOSS = 07TLOSS =_ The final label.
IARCL IGJ X 08 ARCL X Recalls the answer into the ALPHA
register .
1AVIEW 11 ALPHA 1 09 AVIEW Displays the label and answer.
tGTOIGJGJ 00 REG 40
Keystrokes Display
. IGTOIGJGJ 00 REG 40
. ILBL I
1ALPHA 1TEMP 1ALPHA 1 01 LBLTTEMP The program name .
1ALPHA 1HEATER? 1ALPHA 1 02THEATER?
lwTI ((E] ) 03 PROMPT Prompts and stops for input.
1ALPHA 1AIR? 1ALPHA1 04TA/R?
IWTI ((E] ) 05 PROMPT Prompts and stops for input.
G 06 - Finds difference.
tGTojGJGJ 00 REG 36
Note 1ha11he convecl ive heat tran, ft:r coeffi cie nt is an approx ima1ion of 1he actual coeffi c icnl. Care was used lo
find a value 1ha1 resulted in accep1able values for 1he largesl 1e mpera1ure span, cy linde r area. cylinder pos i1ion,
and cons1ruc1ion. The coeffi cienl actually changes a~ ali of 1hese variables change .
186 Subrout1nes
Keystrokes Display
. lGTOI c:J c:J 00 REG 36
. I LBLI
1ALPHA 1AREA 1ALPHA 1 01 LBLTAREA The program name.
1ALPHA1 HEIGHT? 1ALPHA 1 02THEIGHT?
lPROM>TI ((E ) 03 PROMPT Prompts and stops fo r input.
1ALPHA 1RADIUS? 1ALPHA 1 04TRADIUS? Prompts for data.
IPROM>TI ((E ) 05 PROMPT Stops for input.
lsTO I 08 06 STO 08
~
07 Xt2
0 08 PI Computes area of top and bottom.
0 09 *
2 10 2 _
0
l x~y J
11 *
12 X <>Y
IRCLI 08 13 RCL 08
0 14 *
0 15 PI Compute area of the cylinder with-
out the top and bottom .
0 16*
2 17 2 _
0 18 *
[] 19 + G ives the total area.
. lGTOlc:Jc:J 00 REG 30
We now have three programs in program me mory that help determine the heat loss from the
water heater. AREA and TEMP, however, can stand a lone as independent programs a nd
you can run these to find just the area or te mperature difference . BTU , on the other hand ,
uses AREA and TEMP as subroutines . lfthose subroutines do not exist in program memory
when you run BTU, the progra m cannot run in e nt irety. The calculator will search for the
labels , but if they cannot be fo und , it will di splay NONEXISTENT .
Run the BTU program now to find the heat loss (BTUs per hour) from a large cylindrical
water heater with a height of 17.48 feet and a radius of 4 feet. The a mbient room tempera-
ture is 79 degrees Fahrenheit and the temperature of the surface of the heate r is 152 degrees
Fahrenheit.
Subroutines 187
Keystrokes Display
IPAGMI 0.0000 Takes the HP-4 1C out of PRGM
mode.
lxeal
1ALPHA 1 BTU 1 ALPHA 1 HEATER?
152 152 _
IRISI AIR?
79 79 _
1RIS1 HEIGHT?
17.48 17.48 _
IRISI RADIUS?
4 4_
IRIS 1 LOSS = 18,522.2975 Btu per hour.
lf you want onl y the temperature difference or the area, run just those programs (TEMP or
AREA). Run BTU again for a water heater that is 6.2 feet high and has a radius of 1. 1 feet.
The room temperature is 66 degrees Fahrenheit and the temperature of the surface of the
water heater is 89 degrees Fahrenheit.
Keystrokes Display
lxea J
1 ALPHA 1 BTU 1 ALPHA 1 HEATER?
89 89 _
IRIS 1 AIR?
66 66 _
IR1sJ HEIGHT?
6.2 6.2 _
1RIS1 RADIUS?
1.1 1.1-
IRIS1 LOSS =545.4075 Btu per hour.
lcLxJ 0.0000
Subroutine Limits
A subroutine can call up another subroutine, and that subroutine can call up yet another. In
fact, you can have up to six subroutine branches before retumin~ the first program.
Subroutine branching is limited only by the number of 1END1 s or l.!!!!!.l s that can be held
pending by the calculator. Six subroutines can be held pending at any one time in the
HP-41C. The illustration below should make this more clear.
188 Subroutines
;( LB05 / LBL 06
XEQ 06
~'
RTN
The calculator can retum back to tne first program from subroutines that are six deep, as
END
shown. Ho weve r, if you call up subroutines that are more than six deep , the calculator will
retum o nly six subroutines deep . For example, if you call up seven subro utines deep, when
the seventh subroutine is completed , executi on wi ll transfer back onl y six subroutines, back
to the second subrout ine exec uted.
Naturally , the calculator can execute an 1END1 or 1RTN1 instruction as a stop any number of
times. Also, if you execute any of the subroutines manual/y fro m the keyboard (or you
press I RTN 1) ali pending 1END1 and 1RTN1 instructions are forgotten by the calculator.
Single-Line Execution of Subroutines
lf you are executing a progra m one step at a time with the 1ssr1 key in normal mode, and
encounter an 1xeo1 instruction, the calculator wi ll then transfer exec ution to the specified
subrout ine. Yo u can then execute the subroutine one li ne at a time with 1ssr1 . When you
encounter the 1END1 or 1RTN1 in the subroutine, execution transfers back just like a running
program. You can execute programs this way , with 1ssr1 , and the HP-41 C will remember
up to six pending retums, as in a running program.
Local Labels
Earlier, in section 7, you learned how to label or name a program with a string of
ALPHA characters (refer to page 110, The Beginning of a Program). There are 15
ALPHA labels on the HP- 41C that have special functions that are called "local
labels." These 15 labels are 1LBL IA through 1LBL IJ and 1LBL la through 1LBL le (shifted
A through E). Any time you label a portion of a program ora subroutine with one of
these la beis, it is a local la bel. Local la beis are not listed when 1CATALOG1 1 is
executed. Refer to footnote, page 140.
When the HP-41 C is in USER mode and you press one o f the keys in the top two rows (or
and a top row key), the calculator immediate ly begins searching for the corresponding
(A through J, a thro ugh e) local label within the current program. lf the local label is not
found, the calculator executes the function printed on the face of, or above, the key .
For example, when you press ~ in USER mode, the calc ulator fi rst searches fo r a 1LBL1 A
instruction in the c urren! program. The calc ulator searc hes dow nward from the c urre n!
position in progra m me mory to the end of the program. Then it begins searching at the
beginning of the program and back to where the search began.
Subroutines 189
If there is no i LBL 1 A in the curren! program, the calculator e xec utes the ~ function .
Remember, the calculator searches only the curren! program for the local label, it <loes not
search ali of prog ram memory .
If there is a 1LBL 1 A in the curren! program , execution begins at that point. Using the local
labels requires the calculator to be set to the portion of program memory containing the local
label prior to running the program.
When you reassign any other function to the top two row locations for execution in USER
mode, the local label search is not performedfor that particular reassigned location. *
Example: The following program, named SPEED, computes di stance (given rate and
time), rate (given distance and time), or time (given distance and rate). While in USER
mode, you press A when you wish to compute a distance, B when you wish to compute a
rate, and C when you wish to compute a time. The program prompts you for the required
data. Since you assigned IPAOWTI to~ for USER mode operation earlier in this section,
simply press ~ in USER mode when you wish to load a IPAOWTI .
Keystrokes Display
IPRGMI
. jGTOjGJGJ 00 REG 45
. ILBLI
1 ALPHA 1 SPEED 1 ALPHA 1 01 LBLT SPEED The main program.
1 ALPHA 1 A,B,OR C? i ALPHA 1 02TA,B,OR C?
IPROMPTI (~) 03 PROMPT
. I LBLI
1 ALPHA 1 A 1 ALPHA 1 04 LBL A Local label A.
faecution of the normal mode functions on the top rows of keys in USER mode may take several seconds.
The calculator must first search through the curren! prograrn for the local label associated with that key. If no
local label is found, the normal mode function is then executed. This is only true when no otherfunction has been
assigned to that key for USER execution. To shonen this search time, press 1GTO) GJ GJ.
190 Subrout1nes
Keystrokes Display
1 ALPHA 1 RATE? 1 ALPHA 1 05TRATE?
IPAOMPTl ((0 ) 06 PROMPT
1 ALPHA 1 TIME? 1 ALPHA 1 07TT/ME?
IPAOMPTl ((0 ) 08 PROMPT
0 09 *
. l RTNI 10 RTN End of subroutine A .
. , LBL l
i ALPHA J 8 i ALPHA l 11 LBL B Local label B.
i ALPHA 1 DISTANCE? i ALPHA l 12TD/STANCE?
IPAOMPTl ((0 ) 13 PROMPT
1 ALPHA l TIME? 1 ALPHA l 14TT/ME?
IPAOMPTl ((0 ) 15 PROMPT
GJ 16 I
. , RTNl 17 RTN End of subroutine B.
. ,LBL l
1 ALPHA l C 1 ALPHA l 18 LBL C Local label C.
1 ALPHA l
DISTANCE? 1 ALPHA l 19TD/STANCE?
IPAOMPTl ((0) 20 PROMPT
i ALPHA l RATE? i ALPHA 1 21TRATE?
IPAOMPTl ((0 ) 22 PROMPT
GJ 23 I
IGrolGJGJ 00 REG 33 End of subroutine C.
O = RT = 24,791 X 2.5
Subroutines 191
Before you begin, be su re that ali of the upper-row keys do not ha ve any functions assigned
to them. For example, IPACM'TI is now assigned to the ~ key location. To remove the
assignments:
Keystrokes Display
. IAsN I ASN_
i ALPHA J I ALPHA 1 ASN _
~ 00 REG 33
Keystrokes Display
(PRGMI 0.0000
(XEO J
i ALPHA 1 SPEED 1 ALPHA 1 A,B,OR C?
A(~) RATE?
24791 24,791 _ The rate.
1R/S1 TIME?
2.5 2.5 _ The time .
1R/S1 61 ,977.5000 Miles in 2.5 hours.
Now run the program (local label B) to find the rate of travel of the first Antarctic continent
crossing from Shackelton Base to Scott Base by way of the Po le . The crossing spanned
2, 158 miles and took 99 days.
R = D-:- T = 2, 158+ 99
Keystrokes Display
B(~) DISTANCE?
2158 2,158 _ The distance.
1R/S1 TIME?
99 99 _
@:!) 21 .7980 Miles per day.
Finally, run the program (local label C) to find the time for a tsunami (a large wave caused
by a seaquake) to reach the southem shore of the Pacific Island lwo. The wave is traveling at
a constan! 2.25 meters per second and is 300 meters off shore.
Keystrokes Display
C (~ ) DISTANCE?
300 300_ The distance.
IRtsl RATE?
2.25 2.25- The rate .
[ R/ S 1 133.3333 Seconds.
You can continue to execute the local label programs any number of times using the local
label keys without executing the main program each time. All you do is press A ((0 ), B
( ~ ), or C (~ ) in USER mode. But when the calculator is positioned o utside of the
SPEED program , pressing the local keys search only the current program . If they are not
found, the function printed on or above the key is executed.
Problems
1. Look closely at the program fo r finding roots r 1 and r 2 of a quadratic equation (page
182) . Can you see other instructio ns that could be replaced by a subroutine? (Look at
lines 13 through 17 and lines 20 through 24.) Modify the program by using another
subroutine and run it to find the roots of x2 + x - 6 = O; of 3x 2 + 2x - 1 = O.
(Answers: -3.0000, 2.0000; - 1.0000, 0 .3333.)
Did you save any more lines of program memory?
Create and load a program to calculate the area A of a sphere given its radius r . Name
the program SAREA and include an initialization routine to prompt for the value of
the radius. Then create and load a second program to calculate the volume V of a
sphere, using the equation V=(r X A )+3. Name this second program VOLUME and
include an [xeal SAREA to use SAREA as a subroutine to calculate area.
Run the two programs to find the area and volume ofthe planet Earth , a sphere with a
radius of about 3963 miles and of the Earth's moon, a sphere with a radius of about
1080 miles.
(Answers: Earth area = 197 ,359,487 .5 square miles,
Earth volume = 2.607 1188 X 10 11 cubic miles;
Moon area = 14,657,414.69 square miles ,
Moon volume = 5 ,276,669,290 cubic miles.)
Subroutines 193
y = -(g + 2)t 2 - vt + y
where y is the altitude. (In our problem y= O when the plane crashes.)
v is the verti cal componen! of the velocity when powe r was lost. lt is found by
multiplying the velocity by the sine of the flight angle.
Method: Modify the QROOT program that you loaded earlier in thi s section (page
182) so that it no longer prompts for the input of a, b , and c. Write a second program,
based on the following flowchart, that finds the values of a (- g + 2), b (-v) , and e
(y 1). The a should be stored into R 01 b into R 02 and e into R 03 The second program
should use QROOT as a subroutine . The following flowchart will help you write the
program. (Only the positive root is val id as an answer to the problem.)
194 Subrout1nes
Divide 9.80665 by 2;
change sign & store into R01
Multiply velocity
by sine of flight angle;
change sign & store into R02
Execute QROOT
8
195
Indirect Operations
An importan! feature of the HP-41 C is the numerous indirect operatio ns the calcu lator can
perform. Any storage register in the HP-41 C can be used fo r indirect o peratio ns . This capa-
bility greatly expands the power and utility of your HP-4 1C. An indirect addre ss is selected
by follow ing a function with the shift key, , and then a register address. The function
then uses the number in the specified reg ister asan address. Indirect operations are most
useful in progra mming.
For future reference, he re is a complete listing of a li HP-41 C functions that can be used with
indirect addresses:
lsrol nn Store .
lsrolEJ nn Store add (keyboard fo rm ).
lsrolG nn Store subtrac t (keyboard form) .
lsrol@ nn Store multipl y (keyboard form ).
lsro lG nn Store di vide (keyboard form) .
lsr+I. nn Store add (di splay form).
lsr-1 nn Store subtract (display form).
lsrxl. nn Sto re multiply (di splay form ).
lsr+I. nn Store divide (di splay form) .
IAsrol. nn ALPHA store .
IRcLI. nn Recall.
IAACLI . nn ALPHA recall .
lv1ewl nn Yiew registe r contents.
IGrol nn Go to .
lxEOI. nn Execute.
!im nn ~ di splay formal.
(ili]. nn ~ di splay formal.
IENGf . nn IENGf d isplay formal.
lose! . nn Controlled decre ment loo p .
l1sG I . nn Controlled increment loop.
lrONE I . nn Audible tone pitch .
IEREGI. nn Define accumulation registers.
fill nn Set flag.
~- nn Clear flag.
197
198 lndirect Operations
To use an indirect address with a function , first store the desired register address number
(the direct address) in the register yo u are using for indirect control. Then execute the func-
tion and press and specify the indirect address. When you press , the HP-41C
prompts you for the indirect address. Indirect addressing will become more clear as you
read on in this section.
You can indirectly address any of the primary storage registers Roo through R99) or
extended storage registers (R100 through R31s) currently allocated in your
calculator. (Primary storage registers can be addressed directly or indirectly;
extended storage registers must be addressed indirectly.)
If the indirect or direct register address is outside the limits of the current allocation
or the number of registers in the calculator, the display will show NONEXISTENT. In
ali cases only the absolute value of the integer portion of the register address is used
by the calculator.
Keystrokes Display
10 lsrol 02 10.0000 First store the desired reg ister
address (R 10 ) into the indirect
address register (R 02 ).
2.54 2.54_ The number.
lsrol STO IND __ Notice how the HP-41 C prompts
you for the indirect address.
02 2.5400 The number 2.5400 is now stored
into register R 10 .
In the basic HP-41 C, use of primary registers numbered higher than R 62 and use of extended storage
registers require that you extend H P-41 C memory with one or more plug-in memory modules.
lndirect Operations 199
Here is what happened when you used the indirect address to store the number.
The Function
2.54 lsrol 02
To recall numbers that are stored in any primary storage regi sters (R 00 through R 9 9 ), you can
simply press IRcLI and the number keys ofthe register address . You can also recall numbers
from primary storage regi sters using indirect addressing , just like you did when you stored
the number in the above example. Numbers in the extended storage registers (R 0 0oi through
Re31 81) must be stored and recalled using indirect addressing.
For example, recall the number that is stored in storage regi ster R 10 using regi ster R 05 as the
indirect address regi ster.
Keystrokes Display
10 lsrol 05 10.0000 First store the desired regi ster
address into the indirect address
register.
!RCLI . RCL IND __ The HP-41 C prompts you for the
indirect address number.
05 2.5400 The number 2.5400 is recalled from
storage register R 10 .
Here is what happened when you used the indirect address to recall the number.
The Function
IRCLI . 05
Storage reg ister arithmetic is performed upon the contents of the indirectly addressed
register by usi ng lsTOICB nn , (sTO IG nn, lsTo l@ nn , and lsTo lGJ nn . lf
you do not re me mber how storage regi ster arithmetic works, tum to page 74 to refresh you r
memo ry.
ow, multipl y the number in R io by 5280 and then store th at value back into R io using R 11 as
a n ind irect address reg ister.
Keystrokes Display
10 1STO1 11 10.0000
5280 5,280 _
lsTo l@ ST* IND __
11 5,280.0000 The number 5280.0000 is multiplied
by the number in R 10 .
IRCLI 10 13,411 .2000 The answer.
Keystrokes Display
8 lsTol 00 8.0000
1ALPHA1 WATER WATER _
. I ASTOI . ASTO IND __
00 WATER The string, WATER , is now stored
in R08 .
I CLA I
Now recall the string usi ng indirect addressi ng. (Re member, thi s is done in ALPHA mode.)
Keystrokes Display
I ARCLI . ARCL IND __
00 WATER_ The string, WATER , is recalled into
the ALPHA register fro m R 08 .
Clea rs the ALPHA reg ister.
8.0000 Bac k to normal mode.
lndirect Operations 201
Keystrokes Display
11 lsro l8 Z 11.0000 The desired register address (R 11 ) is
stored into stack regi ster Z.
83.9701 83.9701 _ The 11 is now in register T .
lsro l 8 T STO IND T The HP-41 C prompts for the stack
83.9701 address. You can only spec ify a
letter (X, Y, Z , T, or L ) here, the
. lcLxJ 0.0000 HP-4 1C will not accept any other
inputs.
To recall the number that is now in R 11 using stack Z as the indirect address register:
Keystrokes Display
IRCLl 8 z 83.9701
. ICLXJ 0.0000
You should remember that many functions affect the status of the automat ic memory stack
(e.g., pushing numbe rs into the stack), and that when you use the stack registers as storage
registers, the normal stack operation may change the contents of those reg isters.
Keystrokes Display
IPRGMI
IGTolGJGJ 00 REG 46
. I LBLI
1ALPHA 1 SONG 1ALPHA 1 01 LBLTSONG
.009 02 .009 _
lsTol 01 03 STO 01 The first loop control number is
stored in register R01 .
9 04 9 _
lsTol 02 05 STO 02 The second loop control number is
stored in register Ro2
ILBLI 01 06 LBL 01 The beginning of the first loop .
lxEol
1ALPHA 1 TONE 1ALPHA 1
01 07 TONE IND 01 1TONE1 uses R0 1 as an indirect
address. The 1TONE1 function uses
the nu mber in R0 1 to control the
audible tone in the HP-4 1C.
llifil 01 08 /SG 01 Add one to the loop control number
in R0 1 . Test loop control number:
if it is not greater than 9 , e xecute
loop again; if it is greater than 9
skip the next line.
IGTol 01 09 GTO 01 Loop to ILeLI 01.
. ILBLJ 02 10 LBL 02 The beginning of the second loop.
lxEol
1ALPHA1 TONE 1ALPHA1
02 11 TONE IND 02 1TONE1 uses R02 as an indirect
address. The number in R 02 controls
the audible tone.
lndirect Operations 203
Keystrokes Display
lxeo l
i ALPHA l OS E 1 ALPHA l 02 12 DSE 02 Subtract o ne from the loop control
number in R02 Test loop control
number: ifit is not less than orequal
to zero, exec ute loop again ; if it is,
s kip the next line.
IGTOl 02 13 GTO 02 Looptol LeL I 02.
IGTolGJGJ 00 REG 42
Run the program now and listen to the audible tone of the HP-4 1C as it starts with a low
pitch, works up to a high pitch, then back down to the low pitch .
Keystrokes Display
IPRGMI 0.0000
lxeol
1 ALPHA 1 SONG 1 ALPHA 1 9.0000
When you run the program, it executes through the first loop until the loop control number
in R0 1 equals 9. The 1TONE 1 func tion uses the loop control number in R 0 1 indirectly as a spec-
ification of the 1TONE1 value. When the loop cont rol number equals 9, the second loop
begins execution until the loop control number equals O. 1TONE 1 uses the loop control num-
ber in R 02 indirect ly as the 1TONE 1 specification. The second loop doe s not execute 1TONE 1 O.
Execution
1 TSOLVE
.. ASTO 15
1 GTOIND15
L_ LBLT~OLVE
+.
To indirectly address routines or programs out ide of the curre n! program, you can use
lxeo j nn (execute indirect ). When the running program encounters an XEQ IND nn
instruction , execution is transferred to the numeric or ALPHA labe l specified by the
indirect address register. The addressed program is executed as a subroutine and control
return s to the main prog ram when execution o f the s ubroutine is completed . For example ,
with the label CIRCLE sto red in R, 6 , 1xeol 16 causes execution of the program defined
by 1LBL1 CIRCLE. Local labe ls (A th rough J, a through e) cannot be used indirec tly with
i XEO 1,
Note that on ly progra mi. that you write and l>to re into prog ram memory and those functions
contained in plug- in extensions (such as applicat ion module, or the card reader) can be
cxec uted indirectly in this manner. Standard HP-4 1C fun cti ons cannot be executed with
lxeol .
Execution
TC/RCLE
ASTO 16
XEQ IND 16
END
Indirect addressing works the same way with ali of the functions listed on page 197.
Problems
1. One method of generatin g pseudorandom numbers in a prog ram is to take a number
(ca lled a seed"), square it, and then remove the center of the re sulting square and
square that, etc. Thus, a seed of 5 , 182 when squared y ie lds 26 ,853, 124. A random
number generator could then ex tract the fo ur center dig its, 8, 53 1, and square that
value. Contin uing for severa) iteratio ns throug h a loop would generate severa )
random numbers. Fo llowing is a flowchart and prog rammi ng hints for such a
pseudorandom number ge nerator.
The seed is a four-dig it numbe r in the form of nn .nn, .nnnn , or nnnn. The seed is
squared and the square truncated by th e main part of the prog ra m , and the resulting
four-digit random num ber is di splayed in the form of the orig inal seed .
lndirect Operations 205
Store 3
in R00
Extract new
seed of
form .nnnn
1 GT~ ~~irect 1
~
LBL 01
!
LBL 02
~
LBL 03
~
Change form
to nn.nn
8 8 8
T o change a seed i n the form of nnnn. , and .nnnn to nn.nn , you can use fo llow ing
keystrokes:
To change the result , .nnnn , back to the input form , nnnn . or nn .nn :
So that you can remember wh ich fo rm to input , you may wish to label the program
w ith three labe ls, one for each form , like this: ILBLI NN/ NN , ILBLI / NNNN , and
[LBL J NNNN/. When you input a seed of the form nn .nn , you exec ute program
NN/NN. Likew ise, when you input a seed of the form .nnnn or nnnn, you execute
program /NNNN or NNNN/. Use the / character in the names, nota period. Periods
are not legal in ALPHA program labels .
Whe n you key in a fo ur-digit seed in o ne of the three formats and execute the associ-
ated program, an address ( 1, 2, or 3) is placed in the R 00 register. This address is used
by a (GroJ 00 (go to indirect in R00) to transfer program exec ution to the proper
routine so that the new random num ber is seen in the same formas the original seed .
Run the program fo r seeds of 1191 , 11 . 9 1, and . 1191 . The program generales a
random number in the same formas the seed you keyed in. To use the random number
as a new seed, continue executing the associated progra m.
2. Modify the random number generator program you wrote above to use 1xeol indirec t
instead of[ GroJ indirect for control. Run the program with the same seed num bers as
above to ensure that it still runs correctly.
207
Flags
The HP-4 1C flags are a n importa nt programming tool in your calc ulator. A flag actually is a
memory that can ei the r be SET o r CLEAR . A running progra m can then test the flag later in
the program and make a decision, depending o n whether the flag was set o r clear.
Three of the fl ag functions are o n the norma l mode keyboard. They are:
The other flag functions are no t o n the keyboard, but can be assigned to the keyboard fo r
execution in USER mode , or executed from the di splay (refer to section 4). These flag
functions are:
When you execute one of the six flag functions, the HP-41 C prompts you for the flag
number (00 through 55) you wish to operate upon .
209
210 Flags
Keystrokes Display
SF __
im The HP-41 C prompts you for the
flag num ber.
00 0.0000 Flag 00 is now SET. Flag 00
a nnunc iator ( O) tums on in the
display.
Flag decis io ns are made usin g the test flag fu nctio ns (1FS?1 , !Fe ?1 , 1FS?C1 , a nd IFC?CI ).
Each of these funct ions asks a question about the statu s of the spec ified fl ag. In a program,
if the a nswer to the test question is TRUE, the calc ulator executes the next line in the
program (thi s is the " DO if TRUE" rule agai n). lf the answer to the question is false, the
calculator s kips the next line in the program before executi o n continues.
For example, if you use the 1FS?1 (''flag set' ' test) fun ction to check the status of tlag O1 in a
program and the flag is set, the next line in the program is executed. Ifthe flag is clear, the
next line in the program is skipped.
Is flag 01 SET?
-1
Pressed from the keyboard , these flag fun cti ons wi ll show a n answer to the test question in
the d isplay . lf the answer is true , the di splay shows YES; if the ans wer is fa lse, the display
shows NO.
Two of the fl ag tes t fu nctio ns perform an additional fu nction other than asking a question.
These functions , 1FS?C1(''flag set" test and clear) and IFC?CI ('flag clear" test and c/ear),
also c lear the spec ified flag in additio n to testing it.
1f at any time you a re u ns u re as to the s tatu s of the flags, there a re two ways to tell whether a
flag i~ set o r c lear. (Re me mber, the status of sorne fl ags is ma intained by the Continuous
Memory of the HP-4 1C. )
First, and most simply, you can check the status of flags 00 through 04 by simpl y looking in
the di splay at the flag di splay a nnunciato r. lf any of the se fi ve flags are set , the correspond-
ing number wi ll show in the di splay a nnunc iato r at the bo ttom of the dis play w indow .
Second , you can test the fl ag with 1FS?1 o r !Fe ?I without changing its status. Pressed from
the keyboard, these fu nctions return a YES or NO a nswer to the di splay.
Flags 213
For example , if fl ag 00 is set and you use 1FS'?1, the di splay will show YES . On the other
hand , if flag 00 is set and you use IFC?I , the di splay will sho w NO .
Try testing flags 00 and O1 using 1FS'? 1.
Keystrokes Display
IFs? I 00 YES Flag 00 was set in an earlier
example, so the answer to the test is
YES . Notice that the display
annunciator shows O.
IFs? I 01 NO Since flag 01 is not set, the calcu-
lator re tum s an answer of NO .
Example: The following prog ra m contains an infinite loop that illustrates the operation of
a fl ag . The prog ra m altemately displays SET and CLEAR by c hanging and testing the status
of flag OO. A fl owchart for thi s simple prog ram might look like the o ne below.
The prog ram assumes that flag 00 is initially set.
Display SET
Yes
1 Display CLEAR 1
+
Set flag 00
214 Flags
Keystrokes Display
IPRGMI
. IGTOIGJGJ 00 REG 46
. ILBLI
1ALPHA 1 FLAG 1ALPHA 1 01 LBLTFLAG
. I LBLI 01 02 LBL 01
1ALPHA1 SET
lxea l
1AVIEW 11 ALPHA 1
05 PSE
) Display SET when flag 00 is set.
Keystrokes Display
IPflGMI 0.0000
lxea l
1 ALPHA 1 FLAG 1 ALPHA 1 SET SET and CLEAR are displayed
CLEAR alternately as the flag changes
SET status. Also notice that the annunci-
CLEAR ator for flag 00 turns on and off as
SET the flag changes status.
CLEAR
SET
0.0000
Flags 215
Problems:
1. Write a new program that does the same operation as the preceding program, but
instead use 1FS?C1 to control the flag status. The following flowchart will help you set
up the new program . You should be able to save two Iines in program memory over
the previous method .
SF 00
2. Write a third progra m th at performs the same operations as the above programs but
change the flag test functio n agai n. Thi s time use !Fc?cl . He re is a new flowchart .
No Yes
SF 00
216 Flags
Flag Descriptions
Over the next few pages are de scriptions of ali HP-41 C flags . Severa! examples and
proble ms are included to help you become more familiar with how the user flags work.
The status of thi s flag is set to match the status of flag 55 (the printer existence flag) each
time the HP-41 C is turned on. (Flags 21 and 55 are both set if the printer is present and clear
if not. )
Hexadecimal/Decimal Equivalents
Hexadecimal Decimal
o o
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
A 10
B 11
e 12
D 13
E 14
F 15
Jill' s program initiali zes itself by storing the letters A through F in sto rage registers R 10
through R 15 . The program then uses the storage reg ister number to assign a value to the
hexadec imal letter that is input.
Here is a fl owchart that will he lp you understand how the program uses the data input flags
to determine whether numeric data or ALPHA data was input.
Flags 219
Yes
Clear flag 22
No
Yes
Store ALPHA into X-register
Clear flag 23
lncrement R02 by
No 1. Stop if > 15
(Use lliQJ 02)
Keystrokes Display
IPRGMJ
IGro JGJGJ 00 REG 46
I LBLJ
1 ALPHA 1 HEX 1 ALPHA 1 01 LBLTHEX
1 ALPHA J A 02TA _
. I AsroJ 10 03 ASTO 10
B 04TB _
I AsroJ 11 05 ASTO 11
e 06TC_ This initializes the program by
. I ASTOJ 12 07 ASTO 12 storing A through F in R 10 through
o OBTD R 15 , respectively.
. , ASTOJ 13 09 ASTO 13
E 10TE_
I ASTOJ 14 11ASTO14
F 12TF_
, ASTO J 15 1 ALPHA 1 13 ASTO 15
I LBLJ 01 14 LBL 01
1 ALPHA 1 INPUT? 1 ALPHA 1 15TINPUT?
lxEOJ
1 ALPHA J PROMPT 1 ALPHA J 16 PROMPT Prompts and stops for input.
IXEOJ
1 ALPHA J FS?C 1 ALPHA J
Keystrokes Display
l x=rl 27 X= Y? Is input same as stored letter? ...
IGTOI 03 28 GTO 03 ... yes, goes to ILBLI 03.
lsGI 02 29 ISG 02 Increments Ro2 ..
IGrol 02 30 GTO 02 ... goes to 1LBL 102 if number is less
than or equal to 15, and ...
,RTN] 31 RTN ... stops if it is greater than 15
ILBL I 03 32 LBL 03
IRcLI 02
lxeal
1ALPHA 1 INT 1ALPHA 1
1Grol00
33 RCL 02
341NT
00 REG 35
} Displays the integer portion of the
loop control number. It is the same
as the decimal value of the letter
stored in that direct address.
Now assign the program to the ~ key for execution in USER mode.
Keystrokes Display
IPRGMI 0.0000
. , ASN ] ASN _
1ALPHA1 HEX 1 ALPHA 1 ASN HEX _
[B ASN HEX 11
0.0000
Run HEX in USER mode to con ven the following single-digit hexadecimal integers to their
decimal equivalents: 1, B, 9, F.
Keystrokes Display
luseR I 0.0000
IHEXI ( ITJ) INPUT?
1 IRIS 1 1.0000 The decimal equivalen! of
hexadecimal 1.
IHEXI (ITJ) INPUT?
i ALPHA 1 8 i ALPHA l
IR1sl 11.0000 He xadec imal B equals decimal 11 .
IHEXI INPUT?
9 IRISI 9.0000
Flags 24 and 25 are both c leared each time you tum the calc ul ator on.
Range Errors
Reme mber from part 1 of th is handbook that any calcula tio n that exceeds the com putat ion
or storage range of the calc ulator is an e rror (except in stati stics calc ulations). Normall y,
when such a calcu lation is atte mpted, the HP-41C immediate ly di splays OUT OF RANGE
and the e rror-causi ng function is nor executed. Flag 24 allows you to ignore these out-of-
range errors.
If flag 24 is set, then the HP-4 1Cplaces 9. 999999999 X 1099 in to the affected reg ister and
exec uti on continues. Note that the range error ignore flag is nor cleared when the e rror
occurs . Since flag 24 is cleared (automaticall y) only whe n you tum the calculator on, you
only need to set it o ne time at the beginning o fthe program. Ali subsequent range errors will
be ignored by the calculator.
For example, the following program demonstrates how flag 24 works. An infinite loop in
the program begins with 1 x 10 10 and alte mately multiplies and di vides that numbe r by
1 x 10 10 . Each time thro ugh the loop, the result from the previous mult iply is mult iplied by
1 x 10 10 , and the result from the previous d ivide is di vided by 1 x 1010 . Yo u can watch as
the di splayed numbers approach the overflow (9. 999999999 x !099) and the underflow
(0.000000000 x !000 ). Since fl ag 24 is set, the overflow error does not cause the program
to stop.
Flags 223
Set flag 24
Recall Ros
Display Ros
Recall R06
Display R06
Keystrokes Display
IPftGMI
. ,GTO)(!J[!J 00 REG 46
. ILBLI
1 ALPHA 1 FLOW 1 ALPHA 1 01 LBLTFLOW
l0 24 02 SF 24
IEEXI 10 03 1E10
lsTOI 05 04 STO 05
lsTol 06 05 STO 06
. ILBLI01 06 LBL 01
IRCLI 05 07 RCL 05
lxeol
1 ALPHA 1 PSE i ALPHA 1 08 PSE
1 EEXI 10 09 1E10
224 Flags
Keystrokes Display
lsrol0 05 10 ST*05
IRCL I 06 11 RCL 06
jxeo l
1 ALPHA 1 PSE 1ALPHA 1 12 PSE
leex l 10 13 1 E 10
lsro lG 06 14 STI 06
. IGroj 01 15 GTO 01
[Grol GJGJ 00 REG 41
Run the program and watch the numbers as they approach the range over- and undertlows.
Keystrokes Display
IPflGMI . ,CLXI 0.0000
lxeo l
1ALPHA 1 FLOW 1 ALPHA 1 1.0000 10
0.0000 10
1.0000 20
1.0000
1.0000 30
1.0000 -10
1.0000 40
1.0000 -20
1.0000 50
1.0000 -30
1.0000 60
1.0000 -40
1.0000 70
1.0000 - 50
1.0000 80
1.0000 -60
1.0000 90
1.0000 -70
9.9999 99 The overflow is ignored.
1.0000 - 80
9.9999 99
1.0000 -90
9.9999 99
0.0000 00 The underflow .
9.9999 99
Errors
Normally, the HP-41 C halls execution and displays
DATA ERROR when any improper operation (like
divi sio n by zero) is performed . The HP-4 1C also
halts execution and displays OUT OF RANGE when
a range error occurs. When you set flag 25, how-
ever. the HP-41C will ignore a single improper
operation . The operation is not performed but
execution continues.
Note that when the improper operation is attempted, flag 25 is automaticall y cleared .
Because the HP-41 C clears flag 25 when an improper operation is attempted, it is a good
idea to set the flag just prior to the line where you suspect an error might occur. You can
also test the flag immediately after the suspect line. This allows you to prevent bad data
from interrupting your program .
Range errors can be controlled by either flag 24 (range error ignore flag) or flag 25 (the
error ignore flag) because range errors are also treated as errors . Flag 24 a llows you to con -
tinue execution indefinitely when a range error occurs, and flag 25 allows you to detect a
range error and take corrective action.
Example: The following program counts from 5 down to -5 and divides 5 by the count
number. When the count reaches O, normally a division by zero would cause the program to
stop execution. However, this program uses flag 25 to detect the divi sion by zero and
branch around the bad data value, continuing with -1 . Here is a tlowchart illustrating the
prograrn.
226 Flags
Store 5 in R0 1
>- B
Y_es_ _ _
Divide 5 by R0 ,
Decrement R0 ,
Yes
Keystrokes Display
IPRGMI
1Grol88 00 REG 46
I LBLI
1 ALPHA 1 ERROR 1 ALPHA 1 01 LBLTERROR
5 02 5_
lsro l 01 03 STO 01
. I LBL I 01 04 LBL 01
IRCL) 01 05 RCL 01
5 ICHS I 06 - 5 _
. ,X>Y?J 07 X >Y?
. ,RTN J 08 RTN
Flags 227
Keystrokes Display
5 09 5 _
IRCL I 01 10 RCL 01
(ill 25 11SF25
0 12 I
1 13 1-
l sro lG 01 14ST- 01
i xEOI
1 ALPHA 1 FC?C i ALPHA 1 25 15 FC?C 25
. !Gro! 01 16 GTO 01
l x~ YI 17 X <>Y
i xEOI
1 ALPHA 1 PSE 1 ALPHA 1 18 PSE
IGrol 0 1 19 GTO 01
IGrol GJGJ 00 REG 41
ow run the progra m. Noti ce how the div isio n by zero never appea rs.
Keystrokes Display
IPRGMI 0.0000
l xeo l
1 ALPHA 1 ERROR 1 ALPHA 1 1.0000
1.2500
1.6667
2 .5000
5.0000
-5.0000
-2.5000
-1.6667
-1.2500
-1 .0000
-5.0000 The prog ra m ha lls sho wing -5.0000
Example: De De Daldre has a program in her HP-41 C that helps her keep track of her
reading speed. In her job with Dul Publis hing , s he works as a proofreader and she has
fo und th at she mu st proof and mark correction s on one complete line every five seconds
in order to keep up with he r daily quot a of 5760 lines.
At the end o f eac h line, without lifting her eyes from the page, she presse~ any number key
(usua ll y 0). Jf more than about five seconds go by without her pressi ng a number key again,
the program so unds the audible to ne. By placi ng 1PSE1 (pause) instruction s in the progra m,
in combi nation w ith the other program instruction s, the HP-41 C can time approxi mate ly the
five seconds required in thi ~ program. The fo llow in g flow chart will he lp you understand the
flow of the prog ram . The numeric data entry fla g (fl ag 22) is used to detect the press of a
numbe r key, and the audio e nable flag (fl ag 26) is used to control the audible tone .
BEEP
Flags 229
Before you begin , assign the 1PSE1 function to the @ key locati on so that you can input
1PSE1 at the press of a single key in USER mode .
Keystrokes Display
. IASNJ ASN_
1ALPHA J PSE 1ALPHA J ASN PSE _
@ 0.0000
Keystrokes Display
IPRGMJ
I GTOJ GJGJ 00 REG 45
[ili)
1ALPHA 1 PROOF 1ALPHA 1 01 LBLTPROOF
. @) 26 02 CF 26 Disables the audible tone (flag 26 is
initially set) .
@) 22 03 CF 22
ILBL J 01 04 LBL 01
. , BEEP J 05 BEEP Sounds alann if flag 26 is set, not if
flag 26 is clear.
. @) 26 06 CF 26 Clears fl ag 26.
luSER J
!Pse l( @ ) 07 PSE
IPSE J( @ )
IPSE J( @ )
OBPSE
09PSE
} Timing ro ut ine .
IUSER J
lxeo J
1ALPHA 1 FS?C 1ALPHA 1 22 10 FS?C 22 Tests and clears fl ag 22 .
. IGTOJ 0 1 11GTO01 lf flag 22 is set (data has been
entered), goes to ILBL J 0 1.
(El 26 12 SF 26 If flag 22 is clear (data has not been
entered), sets flag 26 .. .
(GTOJ 0 1 13 GTO 01 . .. then goes tol LBL J 0 1.
. IGTOJ GJGJ 00 REG 41
Now run the prog ram to see ifyou can keep up with De De's proofread ing speed. Remember
to look at every word in the line before you press the nu mber key. lf you miss the timing on a
line, go to the next line.
230 Flags
Keystrokes Display
IPRGM I 0.0000
IXEO I
1 ALPHA 1 PROOF 1 ALPHA 1 When program executio n begins,
PROOF beg ins timing you for about
five seconds. If you press a number
key before the timing is over, the
to ne will no t sound . But if you take
too long to press the nu mber key, the
ton e wi ll sound and the program will
immediate ly beg in timing again.
0.0000 Press IRtsl to ha lt exec ution.
In E urope, and many other intemational locations, the radix mark is the comma and the
separato r mark is the decimal point. So numbers appear Iike this: 1.234.567,01 . In the
U.S. the radix mark is the dec imal point and the separator mark is the comma. Numbers
appear Iike this: 1,234,567.01 . The dec imal point flag (28) allows you to use the radix
mark and the separator mark with which you are most accustomed.
Whe n flag 28 is set, the decimal point is the radix and the comma is the separator. Numbers
appear like this: 1,234,567.01 .
When flag 28 is clear , the comma is the radix and decimal point is the separator. Numbers
appear like this: 1.234.567,01 .
Flags 231
You can set , c lear and test flag 28 jusi like the general purpose flags. The status of the
decimal poi nt flag (28) is preserved at all times. Flag 28 is initia lly set (decimal po int is the
radi x, comma is the separator).
The second flag tha t cont rols how numbers appear in the HP-41 C display is the d ig it
grouping fl ag (flag 29). lt controls whether or not a separator is used.
Regardless of which separator mark is spec ified (refer to fl ag 28 description , above), you
can control whether or not a separator appears in the display. 1f your prefere nce is for sepa-
rators, you can specify them . lf your preference is no separators, then you can tum them off.
When flag 29 is set, groups o f three d ig its in the integer portion o f the number are separated
like thi s: 1,234,567 .01 or 1. 234 .567,0 1.
When flag 29 is c lear, numbers are not separated, like thi s 1234567.01 or 1234567 ,0 1.
The status of flag 29 is preserved at all times. The initial statu s is set, so numbers wi ll appear
like thi s: 1,234,567 .Ol.
In (TI!) O when both flag 28 and flag 29 are clear, no radix will appear. At any time ifthere
is only one symbol showing in a number, it is always the radix .
Display Format Flags (~ = flag 40, IENGI = flag 41). When flag 40 is set, the HP-41C
is in~ display format (when flag 40 is set, flag 41 is always clear). lf flag 41 is set, the
calculator is is IENGI display formal (when flag 41 is set, flag 40 is always clear). When
both flags 40 and 41 are clear, the calculator is in @J format. The number of digits
displayed is determined by flags 36 through 39.
Grads Mode Flag (flag 42). lf flag 42 is set, the calculator is in GRAO mode (when flag 42
is set, flag 43 is clear).
Radians Mode Flag (flag 43). lf flag 43 is set, the HP-41 C is in RAD mode (when flag 43 is
set, flag 42 is clear) .
Continuous On Flag (flag 44). Flag 44 controls whether the HP-41 C is in continuous on
power mode or not. When set, the HP-41 C is in continuous on power mode. When clear,
the calculator automatically turns off after 1O minutes of inactivity.
System Data Entry Flag (flag 45). This flag is used intemally by the HP-41 C in data entry.
lt always tests clear for you.
Partial Key Sequence (flag 46). This flag is used intemally by the HP-4JC in function
execution. lt always tests clear for you.
Shift Set Flag (flag 47). Flag 47 is used intemally in shifted operations and always tests
clear for you.
ALPHA Mode Flag (flag 48). This flag is used for ALPHA mode control. When the
HP-4 1C is in ALPHA mode, flag 48 is set, when not , flag 48 is clear.
Low Battery Flag (flag 49). The low battery flag is used to indicate low battery power.
When set, power is low. When clear, power is sufficient. Referto Batteries, appendix B, for
battery replacement instructions. Remember that when battery power is Jow , the BAT
annunciator in the display appears.
Message Flag (flag 50). When set, the display contains sorne message. When clear, the
display contains the default display (ALPHA- or X-register).
SST Flag (flag 51). Flag 51 is used intemally for single-line program execution and always
tests clear for you.
PRGM Mode Flag (flag 52). Flag 52 is used to control PRGM mode. lt always tests clear
for you.
1/0 Flag (flag 53). This flag is used to determine if sorne peripheral extension is ready for
1/0. When set, the extension is ready. When clear the device is not ready for l/0 activity.
Pause Flag (flag 54). When flag 54 is set, a user program 1PSE1 is in progress. When clear,
a pause is not in progress.
Printer Existence Flag (flag 55). This is used to indicate if the standard HP-41 C printer is
attached to the HP-41C . When set, a printer is attached. When clear, no printer is present.
Flag 55 works in conjunction with the printer enable flag (flag 21 ).
Flags 233
Problems:
1. One mile is equal to 1.609344 kilometers. Use the flowchart below to create and
load a program that will permit you to key in distances in either miles ( 1LBL1 MILE) or
kilometers (1 LBL1 KILO). Using a flag anda subroutine , either multiply or divide to
convert from one unit of measure to the other. (Hint: !2!10 yields the same as
0.)
Run the program to convert 187,000 miles to kilometers; to convert 1.2701
ki lometers to miles.
(Answers: 300,947 .3280 kilometers; O. 7892 miles.)
1 1
Place 1.609344 in X
No Yes
Multiply Divide
l'--~~~~------.~~~~~---'I
8
2. Rewrite the timing program you input on page 229 so that it counts the number of
times the flag was set (successful timings). Store that number in a register so you can
check the total later.
234 Flags
3. Rewrite the timing program above so th at it a lso counts the number of times the flag
was cleared (unsuccessful timings). Again , store that number in a register fo r later
reference.
4. The example on page 220 converts single-digit hexadecimal numbers to the ir decimal
equivalents. Using the following flowchart, and the concepts in the example prob-
lem, write a new program that converts two-digit hexadecimals to decimals. A solu-
tion to thi s problem is given following the flowchart. Before looking at the solution,
try writing your own program from the flowchart.
Run the program and convert 4F, 2B, 13, AA to decimal equi valents. The program
prompts you for one digit of the number at a time (e.g., to convert 4F, when the
prog ram prompts you , first key in 4 1R/ S1 , then 1 ALPHA 1 F 1 ALPHA 11 R/ S 1).
(Answers: 79; 43; 19; 170)
No
lncrement A02 by 1,
stop it greater Display
than lS(Use ~ ) result
00 30 10.01501
01 LBLTHEX 31STO02
02TA 32 LBL 05
03 ASTO 10 33 RDN
04TB 34 RCL IND 02
05 ASTO 11 35 X = Y?
06TC 36 GTO 06
07 ASTO 12 37 ISG 02
08TD 38 GTO 05
09 ASTO 13 39 RTN
10TE 40 LBL 06
11ASTO14 41 RCL 02
12TF 42 INT
13 ASTO 15 43 LBL 02
14 o 44 1
15 STO 00 45 RCL 00
16 LBL 01 46 X > Y?
17 1 47 GTO 03
18 ST + 00 48 RDN
19 CF 22 49 RDN
20 CF 23 50 16
21T/NPUT? 51 *
22 PROMPT 52 STO 03
23 FS? 22 53 GTO 01
24 GTO 02 54 LBL 03
25 FS? 23 55 RDN
26 GTO 04 56 RDN
27 GTO 01 57 ST + 03
28 LBL 04 58 RCL 03
29 ASTO X 59 END
Congratu lations !
Yo u have just completed the HP-41C Owner's Handbook and Programming Guide. You
ha ve certainly no ticed that progra mming o n the HP-4 1C is simple, and e ven fun . Yet the
capabi lity of the system is asto unding. Yo ur progra mm ing ex pe rti se w ill increase as you
continue to use your HP-41 C. And you w ill find it an easy matter to complete ly custom ize
your HP-4 1C.
The appendices fo llow ing this section w ill provide you with mo re specific informatio n
about the HP-41 C.
236
Accessories
When you purchase a Hewlett-Packard calculator, you deal with a company that stands
behind its products. Besides an instrument of unmatched professional quality, you have at
your disposal many accessories for the HP-41C system.
Standard Accessories
Your HP-41C Comes Complete With These Standard
Accessories :
HP Part Number
Four Size N Batteries (ready to be installed).
H P-41C/ 41 CV Owner's Handbook and Programming Guide. 00041-90313
HP-41C Quick Reference Guide. 00041-90002
HP-41C Application Book. 00041-90018
One blank Keyboard Overlay.
Soft Carrying Case .
One Module/Overlay Holder
One set of Function Labels
One pre-printed Key board Overlay
237
238 Accessories
To order additional standard or optional accessories, or system exte nsions for your HP-41 C ,
or for information about new optional accessories and exte nsions , see your nearest dealer or
fill out an Accessory Order Form and return it with check, money order, Master Charge or
VISA numbers to:
HEWLETT-PACKARD
COR V ALLIS DI VISION
P.O. BOX 3499
CORYALLIS, OREGON 97330
lf you are outside the U.S., please contact the He wle tt-Packard Sales Office nearest you.
Availability of ali accessori es, standard or optional, is subject to c hange without notice.
Appendix B
Calculator Care
Designed to be durable and dependable, your HP-41 C requ ires virtually no atte ntion to
ensure proper operation. Ali you need to do is:
1. Replace the batteries when the BAT annunc iator in the display appears (refer to
Batteries).
2. Make sure that you keep the caps on the input/output receptacles (ports) in place
whenever a module or other plug-in accessory is not plugged into a port . These caps
prevent the contacts inside the ports from becoming contaminated , which could lead
to improper operation .
CAUTION
Do not insert your fingers or any objects other than an HP module or plug-in
accessory into any port. To do so could alter the Continuous Memory or cou ld
even damage the port or the calculator.
Temperature Specifications
Operating: O to 45 e 32 to 11 3 F
Storage: -20 to 65 e -4 to 149 F
239
240 Maintenance and Service
Plug-ln Extensions
CAUTION
Always turn the HP-41 C off before inserting or removing any plug-in extensions
or accessories. Failure to turn th e HP-41 C off could damage both the calculator
and the accessory.
Batteries
Beca use your HP-41 Cuses so little power, disposable batteries will provide many hours of
calculator operation . The total number of operating hours depends upon how fresh the
batteries were when you purchased and installed them , and how much you use peripherals.
When you use peripherals that draw power from the HP-41 C batteries (such as the
HP 82104A Card Reader or the HP 82 l 53A Optical Wand), total battery life will be
reduced considerably. If the BAT (low power) annunciator tums on (or the display shows
LOW BATTERY) while a peripheral is in use, tum the HP-41C and the peripheral off,
disconnect the peripheral from the HP-4IC, and turn the calculator back o n again. The
batteries will then power the calculator without peripherals for a significan! arnount of time
before the BAT annunciator tums on again . If you use peripherals freque ntly, we recom-
mend that you power your HP-4IC with an HP 82120A Rechargeable Battery Pack. Refer
to the instruction sheet for the rechargeable battery pack for installation and use instructions.
Disposable batteries should be installed as described under Re placing the Batteries. Use
onl y the following alkaline batteries or the HP 82 l 20A Rechargeable Battery Pack in your
HP-41C:
These batteries, like those originally supplied with your HP-41C, are not rechargeable .
WARNING
Do not attempt to recharge the batteries. Do not store batteries near a source of
high heat or dispose of them in tire. Doing so may cause them to leak or explode.
Ma1ntenance and Service 241
Service
Using state-of-the-art technology, the HP-41 C C ontinuous Memory circuits operate
continuously- even while the calculato r is turned off. Because these circuits are always
drawing very low power from the batteries, they are susceptible to disruption at ali times.
Disruption can be caused by inserting or removing plug-in modules or peripherals while the
power is turned on; electrostatic discharge to the unir; strong magnetic fields; plugging
devices into the HP-4/ C that are not supported by Hewlett-Packard for use with the
HP-4/C; or othe r conditions that can traumatize the calculator.
Of course , ali causes of disruption should be avoided , but should disruption occur, the most
common symptom is a loss of keyboard control of the calculator. The HP-41 C has been
designed to allow recovery from these conditions. The procedure fo r resetting the calculator
is to simply remove the battery pack and re place it again immediately. This w ill reset the
HP-41 C w ithout causing a MEMORY LOST conditio n (unless the trauma itself was great
enough to cause a MEMORY LOST condition). Afte r severa! atte mpts, ifthis procedure fails
to reset the calculator, work through the service procedure below .
If the display blanks o ut , or the calc ulator wi ll not respond to keystrokes, do the follow ing:
1. Ensure that the batteries are fresh, are properly installed, and tha t the battery contacts
are not dirty.
2. Turn the calculator off then back on. 1f the calcul ator does not respond , continue on
to ste p 3.
3. While holding down theB key, turn the calculatoron. This is a " maste r clear" and
the entire calculator will be cleared . lf the calc ulator does not respond , continue o n to
ste p 4.
4. Re move the batteries and let the conti nuous me mory in the calculator disc harge over
night. When you rei nstall the batteries and tum the calculator on, if the display shows
MEMORY LOST, you know that the calculator has been cleared.
5 . lf the calculato r still does not respond , service is required (re fer to Limited One-Year
Wa rranty).
Maintenance and Service 243
Repair Policy
Hewlett-Packard calculators are normally repaired and reshipped within five (5) working
days of receipt at any repair center. This is an average time and could possibly vary depend-
ing upon the time of year and work load at the repair center.
No other express warranty is given. The repair or replacement of a product is your exclusive
rernedy. ANY IMPLIED W ARRANTY OF MERCHANTABILITY OR FITNESS IS
LIMITED TO THE ONE-YEAR DURATION OF THIS WRITTEN W ARRANTY. Sorne
states do not allow lirnitations on how long an irnplied warranty lasts, so the above lirnita-
tion rnay not apply to you. IN NO EVENT SHALL HEWLETT-PACKARD COMPANY
BE LIABLE FOR CONSEQUENTIAL DAMAGES. Sorne states do not allow the exclu-
sion or lirnitation of incidental or consequential darnages, so the above lirnitation or
exclusion rnay not apply to you.
This warranty gives you specific legal rights, and you rnay also have other rights which
vary frorn state to state.
HEWLETT-PACKARD COMPANY
CORVALLIS DIVISION SERVICE DEPT.
P. O. Box 999/ 1000 N.E. CIRCLE BLVD.
COR V ALLIS, OREGON 97330
Note: Not ali Hewlett-Packard repair centers offer service far ali models of HP cal-
culators. However, if you bought your calculator from an authorized Hewlett-Packard
dealer, you can be sure that service is available in the country where you bought your
calculator. A list of repair centers far other countries may be obtained by writing to the
above address.
If you happen to be outside of the country where you bought your calculator, you can
contact the local Hew lett-Packard repair center to see if ser vice is available for your model.
If service is unavailable, please ship your calculator .to the following address:
HEWLETT-PACKARD COMPANY
SER VICE DEPT.
1000 N.E. CIRCLE BOULEVARD
CORVALLIS, OREGON 97330
U.S.A.
Shipping lnstructions
Do not return any batteries in or with the calculator. Please refer to Battery Damage on
page 245.
Should your HP-41C require service, the calculator should be returned with the following
items:
1. A completed Service Card , including a description of the problem.
2. A sales slip or other proof of purchase (if the one-year warranty period has not
ex pi red).
3. Whether the unit is under warranty or not, it is your responsibility to pay shipping
charges far delivery to the Hewlett-Packard repair center.
Maintenance and Serv1ce 245
4. After warranty repairs are comple ted , the re pair center retums the unit with postage
prepaid .
5. On out-of-warranty repairs, unit will not be re paired until payment method has been
established . (Refer to HP-41C System Se rvice Card.)
The calcul ator, Service Card , and (if required) the proof of purc hase should be packaged in
its original shipping case or other adequate protective packaging to prevent in-transit dam-
age. Such damage is not covered by the one-year limited warranty; Hewlett-Packard sug-
gests that you insure the shipment to the repair center. The packaged calculator should be
shipped to the address shown on the Service Card .
Battery Damage
Do not retum a ny batteries in or w ith the calculator. The batteries or damage caused by
the batte ries a re not covered by the o ne-year Iimited warranty.
If your HP-41 C is damaged by battery Jeakage you should first contact the battery manu-
facture r for warranty informat ion. Sorne batte ry manufacturers may repair the calculator if
it has been damaged by leaking batteries. If the battery manufac turer warrants against
battery damage , you should deal directly with that manufacturer for repairs. If the battery
manufacturer does not warranty against battery dam age, you should send the calculator to
the Hewlett-Packard for repair. Whether the calculator is under warranty or not, there will
be a charge for repairs made by Hewlett-Packard when the calculator has been damaged by
the batte ries. To avoid this charge, contact the battery manufacturer first when your calcu-
lator has been damaged by the batteries .
Further lnformation
Service contracts are not available. Calculator circuitry and design are proprietary to
Hewlett-Packard, and service manuals are not available to customers.
Should other problems or questions arise regarding repairs, please call your nearest
Hewlett-Packard sales office or repair center.
Appendix C
Your HP-41 C has been designed to operate in a natural, friendly manner. As you ha ve seen
while you worked through this handbook, you are seldom required to think about the opera-
tion of the automatic memory stack or the di splay - you simply work through calculations
in the same way you wou ld wi th pencil and paper, perform ing one operation ata time . There
may be occasions, however, such as when you are creating a program, when you want to
know the effect of a certain operation upon the display of the stack .
Stack Lift
Operations in the HP-41 C are of three types with respect to their effect on the stack . Most
operations enab/e the stack lift. A few operations disab/e the stack lift, anda few others are
neutral.
Enabling Operations
Ali operations on the HP-41 C other than those listed below (under Disabling Operations and
Neurral Operations) enable the stac k lift. lf you key in a number immediately following an
enabling operation, the stack is lifted and the number is entered into the d isplay.
Disabling Operations
lf you key in a number immediately following a disabling operation, the stack is not lifted.
Therefore, the contents of the X-register are not copied into the Y-register before the new
number is keyed into the X-register. The disabling operations are:
1ENTER+ 11 Cl X 1(f!) IB
247
248 Stack Litt Conditions and Termination of Keyboard Entry
Neutral Operations
Neutral operations are those that do not alter the status ofthe stack lift, so that whetheror not
the stack is lifted depends upon the previous operation. Note that 1CHS I and 1EEX1 are neutral
o nly during digit entry. When pressed any other time, 1CHS I and 1EEX1 enable the stack Iift.
The neutral operations are:
Appendix D
Program memory in the HP-41 C is structured in registers. Each register can hold up to seven
lines of program instructions. In ot her words, each register in program memory is divided
into seven parts. One of these parts is called a byte of program memory.
Program Memory
Registers
1
.._ _ _
byte 1
byte 2
l
f---
Each byte 3
register byte 4
contains 7 >----
byte 5
bytes. ---
byte 6
L_ byte 7
Most operations on the HP-41 C require only one byte of program me mory for storage as a
line in a program, but sorne require two or even more bytes. Fo r your reference, the number
of bytes required for storing each programmable HP-41C function is listed in the table
beginning below. The operations are listed in alphabeticaj order of their na me.
Note that ALPHA characters require one byte each plus an additional byte for the string
when stored in progra m me mory. So the string C IRC LE would require se ven bytes of pro-
gram memory. Each d igit in a number requires one byte when stored in program memory.
The decimal point in a num ber also requires one byte. The number 28. 74 1 would require six
bytes of program memory .
Also indicated for each operation is whether the contents of the X-register are copied into
the LAST X register before the operation is performed .
Storage
Requirement Saves x
Function (Bytes) in LASTX
lus) Yes
(B Yes
(El Yes
G Yes
IAovl No
249
250 Program Memory Storage Requirements and LASTX Operations
Storage
Requirement Saves x
Function (Bytes) in LASTX
ALPHA strings, n characters n + 1 No
long ( 1 byte each character
plus 1 byte for the string).
l AOff l No
IAONI 1 No
l AACL I 2 No
1ASHF I No
Assignments. No
j ASTOI 2 No
j AVIEW 1 No
~ . l1oul Yes
(B, leu l Yes
icos- 11, 1ACOSI Yes
l SIN- 1 1, l ASIN ) Yes
ITAw 11, j ATAN I Yes
l BEEP ) No
ICHSI No
l CLRG I No
lCLA I No
lCLDI 1 No
im 2 No
jCLST) No
jcu:I No
ICLxl , jcLx ) No
jcos) Yes
l oecl 1 Yes
jose l 2 No
jDEGI No
jo-R ) Yes
G 1 Yes
jEND ) 3 No
jENG) 2 No
jeex l 1 No
IENTER I 1 No
jx1yl, jxovl 1 No
(E] 2 No
l xeo l (A LPHA, add 1 byte for 2 No
each ALPHA in name.)
jxeo l (indirect) 2 No
lxeol (numeric) 3 No
~. lv.x) Yes
jeu- 11 Yes
Program Memory Storage Requirements and LASTX Operations 251
Storage
Requirement Saves x
Function (Bytes) in LASTX
i FACr l Yes
mKJ 2 No
IFC ?l 2 No
IFC?Cl 2 No
i FS? l 2 No
IFS?Cl 2 No
1F'llC 1 1 Yes
(aro! (00 through 14) 2 No
1aro! ( 15 through 99) 3 No
larol (ALPHA, add 1 byte for 2 No
each ALPHA in name.)
larol (indirect) 2 No
IGRADI No
IHMSI Yes
IHMS+I Yes
IHMS-1 Yes
!BID Yes
(ill) 2 No
ITE!J Yes
ILBL I (00 through 14) 1 No
1LBL 1 ( 15 through 99) 2 No
ILBL I (ALPHA, add 1 byte for 4 No
each ALPHA in name.)
ILOGI Yes
(IE) Yes
i LN1+X 1 Yes
i LASrx l, i LASrX l No
IMEANI Yes
IMool Yes
0 Yes
Iocr ! Yes
(PSEl No
(fil Yes
l%CHI Yes
0. cm No
IP- RI Yes
IPACM>TI No
!OFF l No
IRDI No
IR-o ! Yes
IRcL I (OO through 15) 1 No
lRCL I (16 through 99) 2 No
252 Program Memory Storage Requirements and LASTX Operations
Storage
Requirement Saves x
Function (Bytes) in LASTX
(RcLI (indirect) 2 No
(2!] . rrm Yes
(A- PI Yes
(RTN I No
@:), (ADNI No
@:) No
(ANOI 1 Yes
fil) 2 No
(lli] 2 No
( SIGN 1 Yes
mEl Yes
~. lxnl Yes
@ , (SOATI 1 Yes
(SOEvl 1 Yes
(I:REG I 2 No
(STOPI No
1sTo1 (00 through 15) 1 No
1STO 1 ( 16 through 99) 2 No
(sTo l (indirect) 2 No
lsTol!I) 2 No
lsTol[!J 2 No
lsro l 0 2 No
(sro lG 2 No
G Yes
(uN I 1 Yes
1 TONE i 2 No
(v1ewl 2 No
l x=nl, lx=Y? I No
lx=o?I, (x=o?I No
11, IX>Y?I No
(x>o?I No
(X<Y?I No
(X< O?I No
lx~nl, l x<=Y? ) No
l <&0 '? 1 No
lxnl No
(0011 No
O through 9 No
c:J No
Program Memory Storage Requrements and LASTX Operations 253
Assignments of standard HP-41C functions to key locations consume one register (seven bytes) for each odd-
numbered assigrvnent made. For example, the first assignment made consumes one register, the second assignment
consumes no additional space, the third assignment consumes another full register, the fourth consumes no additional
space, and so on. Assignments of programs that you have written and stored into program memory do not require any
dditional space; the assignment is stored with that program's label.
254
Display Meaning
ALPHA DATA The HP-41C attempted to perform a numeric operation, such as
addition or subtraction, on non numeric data, or on an ALPHA
string.
DATA ERROR The HP-41C attempted to perform a meaningless operation. These
errors are:
where x= O.
where y = O and x:o;;;O, or
where y < O and x is non-integer.
where x< O.
where x=O.
where x:o;;; O.
where x:s;; O.
where x:s;;- J.
where 1 x 1 > l.
where x 1 > l.
J
where x=O.
where l x l ~ 10 or x < O.
where n= O.
where Jx l > 1073741823 (decimal), or x is
non-integer.
1DEC1 where x contains an ALPHA, 8 or9, or x is non-integer.
l%cHI where y = O.
!Iill.~.
IENG) where absolute value of digits is ~ 10 or is non-integer.
1FACT1 where x < O or x is non-integer.
MEMORY LOST The continuous memory of the calculator has been cleared.
NONEXISTENT The HP-4IC has attempted to use a register that does not exist or is
not currently allocated as a storage register.
An attempt was made to 1ASN1 or 1xea 1a function that does not exist.
An attempt was made to IAsNI , !crol, or lxeal an ALPHA or
numeric !abe! that does not exist.
An attempt was made to !crol a Iine number that does not exist.
255
256 Messages and Errors
HP-41C/41CV Extensions
CAUTION
Always turn the calculator off before inserting or removing any plug-in
extensions or accessoriesl Failure to turn the calculator off could damage
both the extension and the calculator.
HP 82143A Printer
For a permanent record of calculation results, or for assistance in checking or editing
long programs, you can connect an HP 82143A Printer to your calculator. Powered
by its own set of batteries, it prints alphanumeric characters quietly and efficiently.
The printer can also be set to provide you automatically with valuable diagnostic
information when creating or running a program. You can obtain a printed record of
program line numbers and function names when creating a program. And when
executing a program or series of manual keystrokes, the printer can provide a record
of the numbers keyed in, functions performed, and answers calculated.
Memory Modules
Hewlett-Packard has developed two types of plug-in modules for adding more
memory to the HP-41C. (These memory modules are not for use in the HP-41CV.)
HP 82106A Memory Module. Each module contains an additional 64 registers that
can be allocated in Continuous Memory as program memory or storage registers, or
any combination. You can use from one to four memory modules (which means you
can have up to 319 registers- 1000 to 2000 program lines- available in the system).
HP 82170A Quad Memory Module. The quad memory module allows you to expand
your HP-41C to a full 319 registers while using only one HP-41C module port.
(Attempting to use more than one quad memory module ora quad memory module
with an HP 82106A Memory Module will not increase HP-41C memory beyond 319
registers and is not recommended.)
There are severa) features on the HP-41 C that offer significan! power and convenience in
the operation of the calculator. As you become more interested in the HP-41 C and how it
works, you may wish to know more specificall y how sorne features work.
Label Searching
Earlier in this handbook it was me ntioned that the HP-41C could remember the location of
most labels in program me mory. More specifically , the HP-41 C has been designed to
remember the location of al/ labe ls depending on the ir locatio n in a program and how they
are u sed. The calculator can only remember a numeric Ja bel location after the first execution
of that label . Subsequent branches to that label are much faster because the HP-41C does not
need to searc h (in most cases) .
Label s 00 through 14 are called short form Jabels. They use only a si ngle byte in program
me mory (there are seven bytes per register). Whe n a program branches to 1LBL 100 through
1LBL1 14 using a lGTOJ instruction, the calc ulator can remember the Jocation of these labels if
they are located 112 bytes before or after the JGTOJ instruction. lf the short form labe l is
beyond 112 bytes from the JGTOJ , the calculator must search sequenti all y for that Jabel . So if
you are concemed about the speed of execution, you should examine your program and
determine the location of branches and corresponding Iabels.
Labels 15 through 99, on the otherhand, are not short fonn labels. They require two bytes in
program memory. However, the Jocation of these labels is al ways remembered by the
calculator, regardless of their location in a program.
The location of ali numeric Jabe ls ( 1LBL1 00 through 1LBL1 99) is reme mbered by the
calculator when the program branches usi ng 1xeol .
The HP-41 C handles branches to ALPHA labe ls in a unique way. As soon asan ALPHA
label is keyed into a program, the calculator records that Jabe l and its Jocation in such a way
that each ALPHA la bel knows where the next ALPHA Jabel is Jocated. A 1GTOJ or 1xeo1of
an ALPHA label the n causes the HP-41 C to search from ALPHA Jabel to ALPHA labe l for
the ALPHA name. The HP-41C then branches to the corresponding location in program
memory. The ALPHA label search is from the bottom-most program in program memory to
the top-most program. The result is a search of the Iast programs first. This ALPHA label
search scheme increases the speed of exec ution by decreasing search time.
259
260 Advanced Programming and Operation
Key Mapping
Another unique feature that you may have discovered is the correspondence between the top
two rows of keys and the numbers 01 through 10. This feature lets you key in a two-digit
label, address or function parameter usi ng a single keystroke.
For example, when you press 1xea1 and the ~ key, the calculator interprets that as 1xeal
O1. The ~ key corresponds to the number O1.
01 01 through 05
06 through 1O
So, when you execute a function that requires a two-digit address or parameter, you can
simply press the key that corresponds to the desired number.
IGTOl@fil = IGTOI 08
ILBLI~ = ILBLI 05
lxeallx~ YI = lxeal 06
lsTol~ = lsTol 02
IRCLI~ = IRcLI 01
Note that if you press one of the top two row keys to specify a number for a function
requiring only a single digit input, only the right-most digit is used by the function . For
example:
m:!)ITANI = m:!J O
IENGI ~ = IENGI 1
However, there are a few things that must be considered before you attempt a 1COPY 1. The
application program on the application module must be able to fit in to program memory. 1f
it does not you will not be able to execute a successful lcoPv). Here is what happens when
you execute 1coPv1 and specify a program name:
1. The calculator first searches for the specified name. If it is not found ( it is misspelled,
or the application module is not in place) the display will show NONEXISTENT
2. The HP-41 C then determines the length of the spec ified program .
3. The size of unused program memory is determined.
4. lfthe unused portion ofprogram memory is large enough to accept the entire applica-
tion program, the program is copied into program memory.
5. In the event that there is not enough room in program memory to hold the entire
application program , the HP-4 1C will pack program memory (packing is explained in
section 8). You will momentarily see PACKING in the display.
6. The calculator will then ask you to reenter the lcoPv) function with the TRY AGAIN
display.
7. lf the unu sed portion of program memory is now large enough to hold the entire
application program, the program will be copied into program memory . lf the un u sed
portion of program memory is still not large enough to hold the application program ,
the calculator will again pack (PACKING ) and ask you to TRY AGAIN
8. At thi s point, you should clear program instructions out of program memory to make
room for the appl ication program. lf you continue to execute 1COPY1 when there is not
enough room in program memory to hold the desired program, the HP-4IC will con-
tinue to pack program memory while displaying PACKING , and ask you to TRY
AGAIN
A ~~~~~~~~--~~~~~~~~-
Absolute Value, 78 Alpha Vicw, 20, 40
~ (Absolute Value), 78 ~ View Key, 72
Accessories, 237 ~ Kcy , Use with Assigning Functions, 62
Accumulations and Summations, 99 1Al.PtlA1 , Use w ith (!!fil when Executing Standard
l ocos! , ~ (Are Cosine), 86 Functions, 57
Adding and Subtracting Time and Angles, 89 Angles, Conversion Between Degrees and
Addressing Stack , lndirect, 201 Radians, 87
Addressing, lndirect Registe r, 197-206 Annunciator, ALPHA, 37
~ (Paper Advance), 105 Annunciator, BAT, 37, 240
Allocating HP-41C Me mory to Data Storage Annunciator. Flags O, 1 , 2, 3, 4, 37
Registers, 73 Annunciator, GRAO, 37, 85
Allocation of Memory, C hanging, 117 Annunciator, PRGM, 37
ALPHA DATA Message. 59, 255 Annunciator. RAO, 37, 85
Alpha Input Flag, 210, 217 Annunciator, SHIFT, 37
Alpha Input, Prompling for , 154 Annunciator, USER , 36
Alpha Key, Use in Execut ing Standard Functions, 57 Annunciators, 36-37
Alpha Keyboard, 18, 19 Antilog, Common , 96
Alpha Label Searching . 184 Antilog, Natural, 96
Alpha Labels. 110 Anti log , Natural (For Arguments Close to Zero), 96
Alpha Labels, Going to in Programs. 159 1-a 1 (Alpha Mode Off), 106
Alpha Labels, Local, 178 ~ (Alpha On), 106
Alpha Mode, 18 ~ (Alpha On), Use in Prompting, 154
ALPHA Mode Annunciator. 16 Append, 40-41
Alpha Mode C haracters. 17 Append, Use in Reentering Alpha Entry , 247
ALPHA Mode Display Annunciator, 37 ~d . Use with Alpha Strings in Programs, 151
Alpha Mode Key, 16 ~ , Use for Long Alpha Strings in Programs,
Alpha Mode Off Function. 106 151
Alpha Mode On Function, 106 Applicat ion Modules. 258
Alpha Numbers, 21 Are Cosine, 86
Alpha On, Use in Prompling, 154 Are Sine, 86
Alpha Program Label Restrictions. 110 Are Tangent, 86
Alpha Prompting in Programs, 151 1A11CL I (Alpha Recall), 70
Alpha Recall, 70 1A11CL I (Alpha Recall), Use in Data Labeling, 154
Alpha Recall. lndirect, 200 Arithmet ic Average, 101
Alpha Recall. Use with Prompl , 152 Arithmetic, Consta n!, 53
Alpha Register. 40 Arithmetic, lndirect Storage Register, 200
Alpha Register Clearing. 41 Arithmetic, Storage Register, 74
Alpha Registcr Scrolling. 40 1ASHF1 (Alpha Shift), 70
Alpha Registcr and Standard Functions Execution , IASHFI (l~~j Shift), Use in Programs, 154
58 1ASH I, (Are Sine), 86
Alpha Register, Shifting in Programs, 154 ~ (Assign), 57, 61-63
Alpha Shift, 70 Assign Key and User Mode Function Execution,
Alpha Shift , Use in Programs, 154 61-63
Alpha Store, 70 Assigning Functions to Top Two Rows of Keys, 189
Alpha Store, lndirect, 200 Assigning Programs to Keys, 114
Alpha String Storage, 70 Assigning User Mode Keys to thcir Original
Alpha Strings and Prompting, 151 Functions, 63
Alpha Strings and the Stack. 71 j
lASTol (tlph Store) , 70
Alpha Strings in Program Line, Maximum Length, IATAHJ ' TAN1 86
151 Audible Tone, 104
Alpha Strings, Programming with, 151 Audio Enable Flag, 210, 227
Alpha Strings, Recalling into the Alpha Register. 70 Automat ic Display Switching, 35-36
Alpha Strings, Use to Labcl Data Outpul , 152 Automat ic Execution Flag, 210, 216
Alpha Strings, Using lAlftHDI in Programs, 151 Automatic Memory Stack, 26, 39-54
Alpha Strings, Use to lndicate Program Status, 154 Automatic Memory Stack Clearing, 47
Alpha Text in Program Notation, 113 Automatic Memory Stack Lift Conditions. 247
262
Automatic Memo ry Stack and Chain Operations, @ID (Clear Dis play), Use in Prograrns, 154
49-51 C lear Display, Use in Prograrns, 154
Automatic Memory Stack and Constant Arithmetic. Clear Flag. 209-213
53 Clear, Master, 23, 120, 242
Automatic Memo ry Stack and One-Number C learing Data Storage Registers, 73
Functions. 47 Clearing Key Assignments, 160
Automatic Memo ry Stack and Two-Number Clearing Operations, 22
Functions, 47 Clearing Prograrns. 119
Automatic Off. IS C learing the Stack. 47
Automatic Stack Drop, 50-51 Clearing the Alpha Register, 22, 41
Automatic Stack Lifl and Chain Operations. 49-51 Clearing the Display. Prograrns, 154
Avera e, Arithmetic, 101 Clearing the X-Register, 22, 42
AVIEW , 40, 72 @) (Clear Program), 119
1Av1ew 1 (Alpha View). in Programs. 151 @) . Program Editing, 125
~ (Clear Ali Registers), 73
-----------------
Back-Step. Program Editing. 125
fCLSTJ (Clear Stack), 47
(fil) (Clear Statistics Registers), 99
Back Arrow Key. 22-23, 42 ( (Clear X), 22, 42
BAT (Low Power) Annunciator . 36 Combinations, Using Factorial Function. 81
BAT Message. 240 Common Antilog, 96
Batte ries. 240 lou) . ~ (Common Antilog). 96
Battcry Annunciator (Low Power). 36 Common Log , 96
Battery Damage. 245 Compiling . Prograrn Branch Locations. 162
Battery Replacement Procedure. 241 Condilional Branching, 170-174
Beep. 104 Conditional Functions, 170-174
Beep Flag, 210, 227 Conditional Tests, 170-174
f BEEPJ , 104 Constant Arithmetic . 53
Beginning a Program . 109 Contents, 2
Beginning of a Program . Going to, 128 Continuous Memory . 11, 39
Branch Locations. Compiling, 162 Continuous Memory. Clearing Data Storage
Branch vs. Subrout ine. 177 Registers. 74
Branches and Subroutines . lndirect Contro l of. 203 Continuous Memory. Prograrns and . 118
Branches. Unconditional, 162 Continuous On Function. 106
Branching and Looping. 159 Control. Dis play. 31-37
Branching, Conditiona l. 170-174 Control. Display Formal, 31-35
(illJ . Program Editing. 125 Control, lndirect Function , 201
c __________________ Control of Subroutines and Branches. lndirect, 203
Controlled Looping. 163-168
Calculating Roots. 98 Controlling the Size of Data Storage Memory, 73
Calculations, C hain . 26 Conversions. Coordinate, 92
Calculator Care, 239 Conversions, Dec imal/Octal , 105
Capacity. A lpha Registe r, 40 Conversions. Dcgrees/Radians. 88
Card Reade r. 258 Conversions, Hours. Minutes, Seconds/Dec imal
Care of Calculator. 239 Hours, 88
Catalog Listing with ~ and (illJ . 61 Conversions. Octal/Decimal. JOS
Catalog Listing. Slowing. 61 Converting Angles Between Degrees and Radians,
Catalog Listing. Sto pping. 61 87
Catalog Listing. Terminating. 61 Coordinate Conversions. 92
~ . 59-61 , 140 ~ Operation. 260
Catalogs. 59-61 ~.260
@ (Clear Flag). 209-213 Correcting Accumulations and Summations, 103
Chain Calculations. 26 Correcting Lines. 139
Chain Operations and Stack Drop. 50-51 Correction Key. 16, 22-23, 42, 59, 125, 136
Chain Operations and the Stack . 49-51 E3 (Correction Key). 16, 22-23, 42, 59, 125, 136
Changc Sign. 21 Correction Key and Function Execution. 59
Change of Pcrcent . 84 Correction Key. Deleting Program Lines, 136
Changing Memory Allocations. 117 Correction Key, Program Editing. 125
Changing the Radix and Digit Grouping Characte rs, (lli] . 86
33 Cosine, 86
Changing the Sign of a Number, 21 , 77 Cosine. Are. 86
Changing the Sign of an Exponen!. 77 Counter Test Value. 163
Character Deletc. 22-23 Counter Value. Current , 163
Charactcrs. Alpha, Programming with . 151 Creating a Program , lntroduction. 109
@E!) (Change S ign). 21 , 77 Curren! Counter Value, 163
(fil) (Clear Alpha). 22, 41 Customized Keyboard , 36, 61-65
263
~~~~~~~~~~~~~~~~-
~ (Degrees/Radians Conversion), 87 Display Execution of Standard Functions, 57-59
Darnage by Batteries, 245 Display Formal Control, 31-35
Data Entry During a Pause, 147 Display Formal, Fixed-Point , 32
Data Entry Keys, Use in Programs, 147 Dis play Forrnat, Scientific Notation, 33
DATA ERROR Message, 255 Display Formats and Number Rounding, 78
DATA ERROR, Decimal/Octal Conversions, 105 Display Scrolling, 16
Data Input Flag, 210, 217 Display and Alpha Register, 40
Data Labeling, 152 Display, Automatic Switching, 35
Data Recall, lndirect, 198 Display, Clearing, Programs, 154
Data, Recalling from Registers, 68 Disphy, Engineering Notation, 34
Data Storage Register Overflow, 75 Display, Fixed-Point , 32
Data Storage Registers, 67-75 Display, Function Names, 41
Data Storage Registers, Arithmetic, 74 Display, Scientific Notation, 33
Data Storage Registers, Clearing, 73 Displayed Mantissa, 31
Data Storage Registers, Setting the Number of, 73 Displaying Alpha Strings, Programs, 151
Data Storage, lndirect, 198 Do If True Rule , 171
Data, Storing into Registers, 68 Do If True Rule for Flag Tests, 212
~ (Octal to Decimal Conversion), 105 @fil (Decrement and Skip if Equal), 163-168
Decimal Hours, Adding and Subtracting, 89 @fil , Executed from the Keyboard, 165
Decimal Hours/Ho urs, Minutes, Seconds Duplication of Numbers in the T-Register for
Conversions, 88 Constant Arithmetic, 53, 54
[!) , Use for Specifying Stack Registers, 69, 71, 74
E~~~~~~~~~~~~~~-
Decimal Point Flag, 33, 210, 230
Decimal Po int Shifting, Engineering Notation 1E+x-1 I (Natural Antilog for Arguments Close to
Display, 35 Zero), 96
Decimal Point , Engineering Notation Display, 34 (E!] , ~ (Natural Antilog), 96
Decimal Point, Fixed-Point Display, 32 Editing Display Entries, 42
Decimal Po int , Scientific Notation Display , 33 Editing Function Names During Display Execution,
Decimal Point, Use to Specify Stack Registers, 201 59
Decimal/Octal Conversions, 105 Editing a Program, 125, 131
Decrement and Skip if Equal , 163-168 @) (Enter Exponent of Ten), 21
Defining Storage Reg ister Configurations, 73 Enabling the Stack, 247
~ (Degrees Mode), 85 End Function , 118
Degrees Mode, 85 End Instruction, 112
Degrees/Radians Conversions, 87 End, Perrnanent, 119
~rees/Radians/Grads Equivalencies, 86 END , ll9
l.illl (Delete Prograrn Lines), 125, 137-139 @QJ' 112
Deleting Characters, 22-23 @QJ Details and Explanation , 118
Deleting Instructions, 136 @ , Use in Subroutines, 178
Deleting Many Prograrn Lines, 137-139 Ending a Program, 113
Deleting and Correcting Data from Statistics ~ (Engineering Notation Display), 34
Registers, 103 Engineering Notation Display, 34
Deleting and Correcting Program lnstructions, 136 Enter Key, 25, 46
Descriptions of Standard HP-4 1C Functions , 77-106 IEHTER I. 25 , 46
Deviation , Standard, 101 IEHTER I and Chain Calculations, 26
Digit Entry Keys, 247 IEHTER I and Two-Number Functions, 25
Digit Grouping Flag, 33, 210, 230 Entry of Data During a Pause, 147
Digits, Significant, 35 Entry, Terrnination of Keyboard , 247
Disable, Stack , 247 Environment, Operating and Storage, 239
Display , 16 Error Ignore Flag, 210, 222
Display Annunciator, 01234 , 37 Error Messages, Program Execution Stops, 147
Display Annunciator, ALPHA, 37 Error Stops, Prograrn Execution , 147
Display Annunciator, BAT, 36 Error-Causing Prograrn Line, Viewing, 147
Display Annunciator, GRAD-RAD, 36, 85 Errors During Standard Function Execution, 59
Display Annunciator, PRGM , 37 Errors, Accumulations , 103
Display Annunciator, RAD , 36, 85 Errors, Range, 222
Display Annunciator, SHIFT, 37 Errors, Using Flags to Process, 225
Display Aonunciator, USER , 36 Exchang ing X and Any Register, 105
Display Annunciators, 36-37 Exchanging X and Y, 45
Display Capacity, 16 Execute Key, 57-59
Display Control, 31 Execute Key Prompt (Underscore), 57
Display Control Flags, 230 Executing Conditional Tests from the Keyboard , 171
Display Editing , 42 Executing Functions During Program Execution, 147
264
Executing Functions From the Display, 57-59 Fractional Portion of a Number, 79
Executing Programs, 114 ~ (Fractional Portion), 79
Executing Programs, Error Stops, 147 (!!!) (" Flag Set" Test), 209-213
Executing Programs, Halting with Prompt, 151 IFs1cl (" Flag Set" Test and C lear), 209-213
Executing Standard Functions, 57~5 Function Names and the Display, 41
Executing Standard Functions Requiring Input, 58 Function Catalog, Standard, 60
Executing Subroutines in Programs, 177 Function Catalogs, 59-61
Executing~ from the Keyboard, 165 Function Execution in User Mode , 61-63
Executing ~ from the Keyboard, 164 Function Name Editing and Correction, 59
Executing a Program Line-by-Line, 129 Function Name Prompts, 24
Execution Order, 52 Function Names, 17
Execution of Program , Pause in , 147 Function Storage Requireme nts, 249-253
Execution of Programs in User Mode, 114 Functions, 23-26
Execution of Programs, Status. 154 Functions, Conditional, 170-174
Execution of Subroutines, Single-Line, 188 Functions, lndirect Capability , 197- 198
Exponential Function , 97 Functions, Non-Programmable, 112
Exponential and Logarithmic Functions, 96-99 Functions, One-Number, 24
Exponents of Ten , 2I Functions, One-Number, Stack Operation, 47
Exponents, Changing the Sign of, 77 Functions, Operating Status. 106
Exponents, Engineering Notation Display, 35 Functions, Stack Disabling, 247
Exponents, Multiples of Three , 35 Functions, Stack Enabling, 247
Extension Catalog, 60 Functions, Stack, Neutral, 248
Extensions, 257 Functions, Standard , Descriptions, 77-106
Extracting Roots, 98 Functions, Trigonometric, 85-95
Functions, Two-Number, 25
F~~~~~~~~~~~~~~~
Functions, Two-Number, Stack Operation, 48
1FACT1 (Factorial), 81 Functions, Use in User Mode , 6~5
Factorials, 81 Functions, Using Standard, 57-65
ffi ("Flag Clear" Test), 209-213 G~~~~~~~~~~~~~~~
IFc?cl ("Flag C lear" Test and Clear), 209-213
General Purpose User Flags. 210, 216
Finding a Program Line, 134
Go To Label in Programs, 159
~ (Fixed-Point Display), 32
Going to Labels in Programs, I59
Fixed-Point Display, 32
Going to a Line Number, I34
Fixed-Point to Scientific Notation Switching, 35
Going to the Beginning of a Program, I28
Flag C lear Test, 209-213
GRAO Annunciato r, 36, 85
Flag C lear Test and Clear, 209-213
GRAD-RAD Mode Annunciator, 36, 85
Flag Set Test, 209-213
)GAADI (Gradians Mode), 85
Flag Set Test and C lear , 209-213
Flag Status Display Annunciators, 37 Grads Mode, 85
Flag Test Functions, 209-213 Grads Mode Display Annunciator , 36
Grads/Degrees/Radians Equivalencies, 86
Flag Tests, Do If T rue Rule, 212
Flag, Alpha Input, 210, 217 @!ID (Go To Label), 159
Flag, Audio Enable, 210, 227 @!ID[!) 125, 128
Flag, Automatic Execution , 210, 216 @!ID[!)[!) , Ending Program, 113
@!ID[!)[!) , lmportance of, 112, 119
Flag, Decimal Point, 210, 230
Flag , Digit Grouping, 210, 230 " ~~~~~~~~~~~~~~~~
Flag, Error Ignore, 210, 222 Halting Program Execution , 145
Flag, Error Processing use, 225 Halting Program Execution from the Keyboard, 147
Flag, Nurneric Input. 210, 217 Halting Program Execution with Prompt , 151
Flag, Printer Enable. 210, 217 H 1 , Programming and Operating Assistance, 245
Flag, Range Error Ignore, 210, 222 (Hours, Minutes, Seconds Addition) , 89
Flag, User Mode, 210, 230 (Hours, Minutes, Seconds Subtraction), 89
Flags, 209-236 ~ (Decimal Hours to Hours, Minutes. Seconds
Flags, Clearing, 209-213 Conversion). 88
Flags, General Purpose, 210, 216 Hours, Minutes, Seconds Formal, 88
Flags, Setting, 209-213 Hours, Minutes, Seconds, Adding and Subtracting,
Flags, Special Purpose, 210, 216 89
Flags. System. 211. 231 Hours, Minutes, Seconds/Decimal Hours
Flags, Testing, 209-213 Conversion), 88
Flowcharting, 120-122 ffifil (Hours, Minutes, Seconds to Decimal Hours
Formal Control, Display , 31-35 Conversion), 88
Formal, Engineering Notation Display , 34
Formal , Fixed-Point Display, 33
Formal, Scientific Notation Display, 33 lncrement Value, 163
265
lncrement and Skip if Greater, 163-168 Labels, Local, Alpha, 178
lndirect Address Register, 199 Labels, Numeric, 111
lndirect Addressing, Specification of, 198 Labels , Numeric, Searching in Programs, 159, 178
lndirect Alpha Recall , 200 Last X Key, 52
lndirect Alpha Store, 200 Last X Operations, 249-253
lndirect Control of Branches and Subroutines, 203 Last X Register , lndirect Addressing of, 201
lndirect Function Control, 201 1LASTX J, 52
lndirect Operations, 197-206 ~ (Program Label), llO
lndirect Recall , 198 Length, Maximum, Alpha String in a Program Line,
lndirect Register Addressing , 197-206 151
lndirect Stack and Last X, 201 Limits of Subroutines, 187
lndirect Storage, 198 Line, Program, Going to. 134
lndirect Storage Register Arithmetic, 200 Line-By-Line Execution of a Program, 129
lnfinite Loops, 162 Line-By-Line Viewing Without Execution, 132
lnitial Display, 16 Lines and lnstructions, Discussion, 116
lnitial Program Memory Configuration, 117 Lines, Correcting, Program, 139
lnitializing a Program, 127 1 ut>+x 1 (Natural Log for Arguments Close to One),
lnput Keys, Data, Use in Programs, 147 96
Input of Data During a Pause. 147 (!!) (Natural Log), 96
Input, Alpha, Prompting for, 154 Loading 1STOP1 into a Program, 145
lnstructions and Lines, Discussion, 116 Loading a Program , 112
lnstructions, Shipping the Calculator, 244 Local Alpha Labels. 178
@!) (lnteger Portion), 79 Local Labels, 110, 178, 188
lnteger Portion of a Number, 79 Local Labels, Searching for, 188
lntermediate Results, Automatic Handling, 26-29 Location of Program Branches, 162
Interna( Functions, Use and Execution, 57-65 Log. Common, 96
Interna) Mantissa, 31 Log. Natural, 96
Interna( Numbers, 31 Log, Natural (For Arguments Close to One), 96
lnterrupting Program Execution, 145-149 [@) (Common Log), 96
lnterrupting Program Execution for Data Entry, 147 Logarithmic and Exponential Functions, 96-99
~ (lncrement and Skip if Greater), 163-168 Long Displays, Scrolling, 36
~ , Executed from the Keyboard, 164 Long Programs, Going to a Line, 135
K ____ __ _ _ _ _ - - - - - - - Looping and Branching, 159
Looping, Controlled, 163-168
Key Assignments, Use of Memory, 63 Looping, Using @!!J and ~ . 163-168
Key Locations, Not Reassignable, 62 Loops, lnfinite, 162
Key Mapping, 260 Loss of Pending Subroutines. 188
Keyboard, 17
Keyboard Customization, 61-65 M__________________
Keyboard Entry, Termination, 247
Magnitude (Absolute Value). 78
Keyboard Program Execution Stops. 147
Mainte nance and Service. 239-246
Keyboard Reassignment , 61-63
Manipulating the Stack, 44
Keycodes for Reassigned Keys, 62
Mantissa. Display, 31
Keying a Stop lnstruction lnto a Program, 145
Master Clear. 23, 74, 120, 242
Keying in Alpha C haracters. 18-20
Maximum Length of Alpha String in a Program Line.
Keying in Negative Exponents. 77 151
Keying in Negative Numbers. 21, 77
Max imum Number of Alpha Characters in a
Keying in Numbers, 20
Register, 70
Keys, Data Entry, Use in Programs, 147
L _ _ __ _ __ _ _ _ _ _ __ _ _ __ Maximum Number of Subroutines, 187
Mean , 101
Label Searching, 159, 178 IMEANJ . 101
Label Searching, Details, 183, 259 Memory Allocations, Changing, 117
Label Searching, Local, 188 MEMORY LOST Message, 16, 23, 74, 120, 255
Label Usage, 111 MEMORY LOST, Master Clear. 242
Labeling Data Output with Alpha Strings, 152 Memory Modules, 257
Labeling Data from Programs, 152 Memory Stack, lndirect Addressing. 201
Labeling Data, Scrolling, 153 Memory Use by Key Assignments. 63
Labeling Program Output . 152 Memory. Continuous. 118
Labeling a Program, 110 Memory. Program. Description. 116
Labeling a Program with a Numeric Label, 110 Messages and Errors. 255-256
Labeling a Program with an Alpha Label, 110 Messages. Error. Program Execution Stops. 147
Labels, Alpha, Going to in Programs, 159 Minus Sign, 21
Labels, Going to in Programs, 159 Mistakes. Using Last X for Recovery. 52
Labcls, Local, 110, 140, 178, 188 ~ (Modulo), 79
266
Mode, Degrees, 85 Order of Execution , 52
Mode, Grads, 85 OUT OF RANGE Message, SO, 75, 256
Mode, Nonnal , 39 OUT OF RANGE Message, Factorial s, 81
Mode, Radians, 85 OUT OF RANGE Message, Percents of C hange, 84
Modes, Trigonometric, 85 OUT OF RANGE Message, Range Error.; , 222
Modifying a Program , 131 Output from Programs, Labeling, 152
Modulo, 79 O verflow, Storage Register, 75
N ~~~~~~~~~~~~~~~~-
P ~~~~~~~~~~~~~~~~
Names, Functions, 41
Natural Antilog, 96 ~ (Polar to Rectangular Coordinate Conversion),
Natural Antilog (Fo r Arguments C lose to Zero), 96 94
Natural Log, 96 INCKI , 141
Natural Log (For Arguments C lose to O ne), 96 PACKING Message, 73, 256
Natural O rder Rule and the Stack, 49 Packing Program Memory, 141
Negative Exponents, Keying in , 77 Paper Advance, 105
Negative Numbers, 21 Pause Function, 147
Negative Numbers, Keying in , 7 Pause Operation, Data Entry, 147
Neutral Stack Operations, 247 Pause in Program Execution , 147
NO Message, 256 Pending Retums, Subro utines, 188
NO Message, Conditionals, 171 Percent, 83
NO Message, Flag Tests, 212 00 (Percent) , 83
Non-Programmable Operations, 112 Percent of Change, 84
NONEXISTENT Message, 59 , 62, 73, 255 ~ (Percent of C hange), 84
NONEXISTENT Message, lndirect Operations, 198 Percentages, 83
NONEXISTENT Message, Local Labels, 178 Peripherals, 257
NONEXISTENT Message, Program Labels , 184 Perrnanent End in Memory , 119
NONEXISTENT. Program Labels, 159 Perrnutations, Using Factorial Function , 81
Normal Mode, 16, 39, 42 Pi, 82
Number, Extracting t he Fractional Portion of, 79 @ . 0 . 82
NULL Message and Operat ions, 17, 24, 41, 256 P lacing Alpha Characters in the Display, Programs,
Number, C hanging the Sign of, 77 151
Number, Extracting the lnteger Portion of, 79 Placing Numbers into the Stack with Enter, 46
Numbers, Interna). 31 Polar/Rectangular Coordinate Conversions, 92
Numbers. Recalling, 68 Positioning Program Memory Using Catalog 1, 140
Numbers, Recovering fo r Calcu lation using Last X, Positioning the Calculatorto the End of Memory, 112
53 Power lnterruption , 16
Numbers, Rounding, 78 Power O ff, 106
Numbers, Squaring , 82 Power On, IS
Numbers, Storing, 68 Powers, Raising Numbers to, 97
Numeric Input Flag, 210, 217 Prefix C hart , Sc ientific and Eng ineering Display, 34
Numeric Labels, J 1J Pressing Keys During Program Execution, 147
Numeric Labels, Searching, 178, 184 PRGM (Program Mode) Display Annunciator, 37
Nume ric Labels. Searching in Programs, 159 ,_ (program) Mode Key, 16
Numeric Program Labels, 1 JO Primary Alpha Keys, 18
Primary Storage Registers, 67-75
~~~~~~~~~~~~~~~~- Printer, 258
(@ (Decimal to Octal Conversion), 105 Printer Enable Flag, 210, 216
Octal/Decimal Conversions, 105 PRNATE Message, 256
Off Function, 106 Problems, Order of Execution, 52
@!El (Power Off), 106 Program Branc h Locations, Compiling, 162
On Key, 15 Program Creation , 109
On, Continuous, Function, 106 Program Editing, 125, 131
~ , (Continuous On), 106 Program End , 113
One-Number Functions, 24 Progra m Execution Stops Caused by Errors, 147
One-Number Functions and the Stack , 47 Program Execution Symbol, 114
Operating Environment, 239 Program Execution, Pause in , 147
Operating Keys, 15- 16 Program Execution , Stopping, 145
Operating Status Functions, 106 Program Execution, Stopping with Prompt, 151
Operations, C ha in , Stack , 49-51 Program File, 119
Operations, Conditional , 170-174 Program lnitia lization , 127
Operations, lndirect, 197-206 Program lnstructions, Delcting, 136
Operations, Non-Programmable, 112 Program lnterruptions, 145-149
Operations, Order of Execution , 52 Program Label, 109
Optional Accessories , 237 Program Label Restrictions, 110
267
Program Label Usage, 111 Recalling Numbers, 68
Program Labels, Alpha, 110 Reciprocals, 80
Program Labels, Going to, 159 GTIJ (Reciproca!), 80
Program Labels, Numeric , 110, 111 Recovering From Mistakes Using Last X, 52
Program Labels, Searching, 159 Recovering a Number for Calculation using Last X,
Program Line , Going to, 134 53
Program Lines, Correcting, 139 Rectangular/Polar Coordinate Conversions, 92
Program Memory Description, 116 Redundan! Digits , Statistics Problems, 101
Program Memory Storage Requirements, 249-253 Reentering Alpha Entry , 247
Program Memory , Initial Configuration, 117 Register Addressing, lndirect, 197-206
Program Mode, 37, 112 Register, Alpha, 40
Program Mode Display Annunciator, 37 Register, Alpha, Shifting in Programs, 154
Program Modifications, 131 Register, Alpha, Viewing the Contents of, 72
Program Output, Labeling, 152 Register, lndirect Address, 199
Program Status, 154 Register, Last X, Indirect Addressing of , 201
Program Execution, Line-By-Line , 129 Registers, Arithmetic Usin'g, 74
Program , Definition of, 109 Registers, Exchanging X and Any Other, 105
Program, Running a, 128 Registers, Primary Storage, 67-75
Program, Longer Than 999 Lines, 135 Registers, Recalling Data From, 68
Programming Assistance, 245 Registers, Stack, 39
Programming a Stop, 145 Registers, Stack, lndirect Addressing of, 201
Programming with Alpha Strings, 151 Registers, Stack, Storing Data into, 69
Programming with Conditionals, 170-174 Registers, Statistics, Setting Location of, 99
Programming, Alpha String Prompting, 151 Registers, Storage into , 68
Programming, Simple, 109 Registers, Viewing the Contents of, 72
Programs, Clearing, 119 Remainder (Modulo) Function, 79
Programs, Go To Label in, 159 Repair Policy, 243
Programs, Using Alpha Strings in, 151 Repair Service, 244
Prompt Character, 22 Replacing the Baneries, 241
1~1 . 151 Resening to the Beginning of a Program , 128
Prompting, 151 Restrictions to Alpha Program Labels, 110
Prompting for Alpha Input, 154 Retuming to the Normal Mode Function , 63
Prompts, Function Name, 24 Reviewing the Stack , 44
Proper and Improper Program Labels, 111 ~ (Round) , 78
~ (Pause), 147 Roll Down Stack, 44
~ (Roll Down) , 44
R ~~~~~~~~~~~~~~~~~-
Roll Up Stack, 44
~ (Radians/Degrees Conversion), 87 ) (Roll Up), 44
B (Rectangular to Polar Coordinate Conversion) , ROM Message, 256, 261
93 Roots, Calculating, 98
~ (Run/Stop), Use to Stop Program Execution, Roots, Square, 81
147 Rounding (Display), 31
~ (Run/Stop) , 145 Rounding a Number, 78
RAD Annunciator, 36, 85 Rounding, Engineering Notation Display, 34-35
fil (Radians Mode), 85 Rounding, Fixed-Point Display, 32
Radians Mode, 85 Rounding, Scientific Notation Display, 33
Radians Mode Display Annunciator, 36, 85 RPN , 29
Radians/Degrees Conversions, 87 ~ , Use in Subroutines, 178
Radians/Degrees/Grads Equivalencies, 86 ~ , Using to Position , 128
Radix, 230 Rule, Do lf True, Conditional Branches, 171
Raising Numbers to Powers, 97 Running a Program, 114, 128
RAM Message, 256, 261
Range Error Ignore Flag, 210, 222
Range Errors, 222 !ill (Scientific Notation Display), 33
~ (Recall), 68 Scientific Notation Display, 33
Reassignable Key Locations, 62 Scientific Powers of Ten, 33
Reassigned Functions in User Mode, Use, 63-65 Scrolling, 16, 35-36, 40
Reassigned Functions, Perrnanence, 65 Scrolling, Data Labeling, 153
Reassigning User Mode Keys to their Original 1soevl (Standard Deviation) , 101
Functions , 63 Searching for Labels, 184, 259
Reassigning the Keyboard, 61-63 Searching for Labels, Programs, 159
Recall , lndirect , 198 Searching for Labels, Subroutines, 178
Recalling Alpha Strings, 70 Searching for Local Labels, 188
Recalling Data from Stack Registers, 69 Searching for Numeric Labels, 178, 184
Recalling From the Exended Registers, 198 Searching for Numeric Labels in Programs, 159
268
Separator, Digits, 230 Standard Functions, 77-106
Service, 242 Standard Functions, Display Execution, 57-59
Set Flag, 209-213 Standard Functions, Use and Execution, 57-65
Setting the Number of Data Storage Registers, 73 Statistical Functions, 99-104
!E (Set Flag), 209-213 Statistical Register Contents, 100
SHIFT Annunciator, 17, 37 Statistical Registers, Setting Location of, 99
Key, 17 Status Annunciators, 36-37
Shift Key, use to Specify lndirect Addressing, 198 Status Annunciators, Flags O, 1, 2, 3, 4, 37
Shifted Alpha Characters, 18 Status of Program Execution, Using Alpha Strings,
Shifting the Alpha Register in Prog.rarns, 154 154
Shifti ng the Contents of the Alpha Register, 70 Status, Operating, Functions, 106
Shipping lnstructions, 244 Strings, Alpha, Programming w ith , 151
Sign Function (Unary of X), 85 (!!fil (Sto re), 68
Sign, Changing, Exponents, 77 [f) , (!!fil[IJ (Storage Register Add ition), 74
Sign, Number, Changing, 77 (!!!) , C!!IDG (Storage Register Division), 74
l SIGN I (Unary of X), 85 ~ , (!!fil 0 (Storage Register Muliplication), 74
S ignifican! Digits, Engineering Notation Display, 34 (!E) , C!!IDG (Storage Register Subtraction), 74
Simple Programming, 109 lSTOPI , 145
(fil) (Sine), 86 Stopping Program Execution from the Keyboard,
Sine, 86 147
Sine of Pi Radians (Footnote), 86 Stopping Program Execution with Prompt, 151
Sine, Are, 86 Stopping the Catalog Listing, 61
Single-Line Execution of Subroutines, 188 Storage Environment, 239
Single-Line Execution of a Prograrn, 128 Storage Register Arithmetic, 74
Single-Step, Prograrn Editing, 125 Storage Register Arithmetic and the Stack, 74
Size Function, 73 Storage Register Arithmetic, lndirect, 200
Size of Memory, 117 Storage Register Overflow, 75
ls1u r, 73 , 117, 125 Storage Registers, Data, Clearing, 73
Slowing the Catalog Listing, 61 Storage Registers, Setting the Number of, 73
Special Purpose User Flags, 210, 216 Storage Requireme nts, 249-253
Specificatio ns, Temperature, 239 Storage, Data, 68
Specifying lndirect Addressing, 198 Store, lndirect, 198
Specifying Stack Registe rs With Decimal Point, 201 Storing A lpha Strings, 70
lsoRTI , @ (Square Root), 81 Storing Data into Stack Registers, 69
Square Roots, 81 Storing Numbers, 68
Squaring Numbers, 82 Storing and Recalling Numbers, 67-75
(!!!) , ~ (Square), 82 Storing into the Extended Registers, 198
ffi!l , Prograrn Editing, 125 Strings, Alpha, Prompting in Prograrns, 151
Stack Disable, 247 Strings, Alpha, Recalling, 70
Stack Drop and Chain Operations, 50-51 Strings, Alpha, Storage, 70
Stack Enable, 247 Strings, Alpha, Use to Label Output, 152
Stack Lift Operations, 247 Strings, Alpha, Using IAlftNDI in Programs, 151
Stack Lift and Chain Operations, 49-51 Strings, Alpha, and the Stack, 71
Stack Operation with One-Number Functions, 47 Subroutine Limits, 187
Stack Operation, Enter Key , 46 Subroutine Types, 178
Stack Operation , with Alpha Strings, 71 Subroutine Usage, 183
Stack Operations, Neutral , 248 Subroutine vs. Branch , 177
Stack Registers, 39 Subroutines, 177-194
Stack Registers and Storage Register Arithmetic , 74 Subroutines Inside the Prograrn File, 179
Stack Registers, Recalling Data from , 69 Subroutines Outside the Prograrn File, 179
Stack Registers, Storing Data into, 69 Subroutines and Branches, lndirect Control of, 203
Stack Structure, 40 Subtracting Time and Angles, 89
Stack , Automatic Me mory, 39-54 (0 (Summations), 99
Stack, Chain Operations, 49-51 ~ (Summation Minus), 103
Stack, Clearing, 47 Summations and Accumulations, 99
Stack , lndirect Addressing of, 201 li:REGI (Set Location of Statistical Registers), 99
Stack, Manipulating, 44 System Flags, 211, 231
Stack , Natural Order Rule, 49 T _ _______
Stack , Reviewing, 44
Stack , T-Register Duplication, 53, 54 T-Register, 39
Standard Accessories, 237 T-Register Duplication, 53, 54
Standard Configuration, Data Storage Registers, 67 @El (Tangent), 86
Standard Deviation, 101 Tangen!, 86
Standard Function Catalog, 60, 77 Tangent, Are, 86
269
Tenninating a Catalog Listing, 61 (X>Y?I , 171
Tennination of Keyboarcl Entry, 247 y _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
Test Value, Counter, 163
Testing Flags, 209-213 Y-Register, 39
Testing the X-Reg ister, 170-174 YES Message, 256
Tests, Conditional , 170-174 YES Message, Conditionals, 171
Text in Program Notation, 113 YES Message , Flag Tests, 212
lbeta Angle Representation , for Coordinate (!!!) . ~ (Exponential Function), 97
Conversions, 93 z _________________
Tone, 104 Z-Register, 39
)TCNJ , 104
00 REG nn Message, 112
Top Two Rows of Keys as Local Labels, 188
Trigono metric Functions, 85-95
Trigonometric Modes, 85
TRY AGAJN Message, 73, 117, 256
TRY AGAIN, Program Editing , 134
Two-Number Functions, 2S
Two-Number Functions and the Stack, 48
Types of Subroutines, 178
u _______ - - - - - - - - - -
unary of X, 8S
Unconditional Branches, 162
User Catalog. 60
User Flags. 209, 210
User Keyboard Key Locations, Not Reassignable,
62
User Mode Annunciator. IS, 36
User Mode Assignments. Memory Use , 63
User Mode Execution of Programs, 114
User Mode Flag. 210, 230
User Mode Functions. 61-63
User Mode Key, IS
User Mode Keyboard Functions, 63-6S
)uSEAI Key and User Mode Annunciator, 36
v __________________
View Key. 72
72
(VIEWI ,
Viewing Programs Without Execution, 132
Viewing an Error-Causing ~ram Line, 147
Viewing the Cata logs with ~ and C!ill , 61
Viewing the Contents of Any Register, 72
Viewing the Conte nts of the Alpha Register, 72
w________________
Warranty, 243
x _____
~ , (!:!) (Square), 82
X-Register. 39
X-Register C learing, 42
X-Register, Testing, 170-174
@ID. S7-S9
@ID (Execute). In Programs, 177
~ . 171
C!!ffi . 171
(xco?I, 171
(x.. 01 1, 171
(x..nl . l!l , 171
(!!!) (Exchangc X and Any Register) . 105
)X<>YI ' (X Exchange Y), 44-45
)XY?I , 171
(x o?I , 170
(X Y?I , 170
lxo?I , 171
270
Function lndex
Ali HP-41 C functions can be recorded as instructions in program memory except those
indicated. Functions with one name for keyboard execution and a second name for display
execution are shown adjacent to each other in the columns below (e.g.,@J on the keyboard
and SQRT in the display). Unless otherwise noted, all of the following functions can be
executed from the display and reassigned . Functions unique to the ALPHA mode keyboard
are marked with . Refer to the ALPHA mode keyboard on page 19 or on the back of the
calculator. Note that only the functions on the normal or ALPHA mode keyboard a~e shown as
key functions, even though all HP-41 C functions may be assigned to the keyboard (except
those indicated). To execute a function from the display, press 1xeo11 AlJIHA 1, key in the alpha
characters shown, then press 1AlJIHA 1 .
Function Description
Display Keyboard
Execution Execution
+
0
Shift key (page 17, 18). Not programmable or assignable.
Addition operator (page 25).
G Subtraction operator (page 25).
X 0 Multiplication operator (page 25).
0 Division operator (page 25).
1IX ~ Reciproca! (page 80).
10fX ~ Common antilogarithm (page 96).
ABS Absolute value (page 78).
ACOS Are cosine .(page 86).
ADV Advance paper if printer is in system (page 105).
AOFF 1AlJIHA1 ALPHA mode off (page 154). The ALPHA mode key
mode key (page 18) is not programmable or assignable.
AON 1ALPHA1 ALPHA mode on (page 154). The ALPHA mode key
mode key (page 18) is not programmable or assignable.
IAPPENDI. Append ALPHA display (page 40, 151 ). Not assignable,
not executable.
ARCL ALPHA recall. Requires 2-digit, stack, indirect 2-digit, or
indirect stack address (page 70).
ASHF ALPHA shift left (page 154).
ASIN Are sine (page 86).
271
ASN IASNI Assign. Requires function name and key location input
(page 61 , 115). Not programmable.
ASTO IASTol ALPHA store. Requires 2-digit, stack, indirect 2-digit, or
indirect stack address (page 70).
ATAN ITAN- 11 Are tangent (page 86).
AVIEW 1AVIEW I ALPHA view (page 72, 151).
BEEP 1BEEPI Beeper (page 104).
BST 1BSTI Back step (page 132). Not programmable.
CAT ~ Catalog list. Requires 1-number input. or indirect address
(page 60, 140). Not programmable.
CF @Il Clear program flag. Requires 2-digit, indirect 2-digit, or
indirect stack address (page 209).
CHS lcHsl Change sign (page 77).
CLA ICLAI. Clear ALPHA register (page 41 ).
CLD Clear display (page 154).
CLP Clear program . Requires program name input (page
119). Not programmable.
CLRG Clear all storage registers (page 73).
cu lcu:I Clear statistics registers (page 99).
CLST Clear automatic memory stack (page 47).
CLX 1CLX/A1 Clear X-register (page 42).
COPY Copy (download or copy). Requires ALPHA program
name input (page 260). Not programmable.
EJ Correction key (page 22, 42, 136). Not assignable, not
programmable.
cos lcosl Cosine (page 86).
D-R Degrees to radians conversion (page 87).
PROMPT
'"'"'
mode key
Program mode key (page 106, 112). Not programmable.
275
-
..
F//-p9 HEWLETT
~~ PACKARD