100% found this document useful (1 vote)
973 views282 pages

HP41C

calculo

Uploaded by

alex_tamayo_7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
973 views282 pages

HP41C

calculo

Uploaded by

alex_tamayo_7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 282

HEWLETI-PACKARD

1 OWNERS HANDBOOK AND


PROGRAMMING GUIDE
HP-41C/41CV
"The success and prosperity of our company will be assured only if we offer our customers
superior products that fill real needs and provide lasting value, and that are supported by a
wide variety of useful services, both before and after sale."

Statement of Corporate Objectives


Hewlett-Packard

/( 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

The HP-41C/41 CV Alphanumeric Full Peormance


Programmable Calculator

Owner's Handbook
and
Programming Guide

September 1980

00041 -9031 3

Printed in U.S.A. Hewlett-Packard Company, 1980


Contents

Introducing the HP-41C and HP-41CV . ..................... .. .... .. . .. .. 7


The Philosophy of the HP-41C/ 41 CV Systems ...................... 7
Sample Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Major Configuration Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Part 1: Using Your Calculator .... .. . .... . .. .. .. . . .... . . .. ...... .. .. ..... 13


Section 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Operating Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Display .................. . ........ . ........... . ................ 16
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Keying in Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Clearing Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chain Calculations ......... .. ........................ . . .. ....... 26
Before You Continue .................. . .... . .... . ............... 29

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 4: Using the Standard Functions ...... .. ............ .. . ....... .. 67


Executing Functions from the Display . . .. . ... ...... .. ...... .... ..... 67
The Catalogs ...... .. . ... . .... . . .. ... .. . .. ....... . . ....... ..... .... 69
USER Mode Functions .............. . .......................... ... . 61

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

Section 6: Functions .. ............................ ........ ........... 77


The Standard Function Catalog .... ... ... ... . ........... . ........... 77
General Mathematics Functions ........ ...... .. ....... . . .. . . . .. . . 77
Changing the Sign of a Number ................................ 77
Rounding a Number .... .. ........... ............. . .. ...... . ... 78
Absolute Value . ... ... ...................... .. ..... .. ...... . .. 78
lnteger Portian of a Number ......................... .. ... ...... 79
Fractional Portian of a Number ........ .. .......... . . . .......... 79
The Modulo Function .. ... .... .... ... ... ... . ... . ..... . .. ... . . . . 79
Reciprocals ....................................... ... . . ...... 80
Factorials ........... . .................................... .... 81
Square Roots .. ...... . . ............ ..... ............ .. .... . ... 81
Squaring ....................... ... ........................... 82
Using Pi ................................... .. ................ 82
Percentages ..... ............. .. . . ............... ..... . ..... .. 83
Percent of Change .... ......... ................. . ... ....... .. . 84
Unary of X .............................. . . ... . .......... ... . . 85
Trigonometric Functions ...... ........ . ...... .... . .... ........... 85
Trigonometric Modes ....................... .. .. .. ... ... .. .. ... 85
Trigonometric Functions ............. ... ...... . ..... ..... ...... 86
Degrees/Radians Conversions .... . ... . .................. ... .... 87
Hours, Minutes, Seconds/Decimals Hours Conversions ............ 88
Adding and Subtracting Time and Angles ................... ..... 90
Polar/Rectangular Coordinate Conversions ........... ......... ... 92
Logarithmic and Exponential Functions ................. .. .... .... . 96
The Exponential Function ............................. ... ...... 97
Statistical Functions ..... ... .............. .. . ... . ... . .. . . .... ... .. 99
Accumulations ............... ....... . . ....... ... ........ . .... . 99
Mean . .......... . . .......................... . .... . . . . . ...... 101
Standard Deviation ........... . ....... ...... . . . . .... . .. . .... . . 101
Deleting and Correcting Data ........ ..... ... ........ .......... 103
4 Contents

Operational and General Functions .................... . .. ....... 104


Audible Tone Functions ........ ........................... .... 104
Decimal/Octal Conversions ...... . . . . . . . ... .. . ..... ...... . ..... 105
Exchanging X and Any Register ........................ .. ..... 105
Paper Advance ........ .. . . ............................. . .... 105
Power ON .................................................. 106
Power OFF ............................................. .... 106
PRGM Mode ............ . . .. . . .............................. 106
ALPHA Mode ............ . .. . . . ........ . ................. . . . . 106
Part 11: Programming Your Calculator . .... ............................. . 107
Section 7: Simple Programming ......................... . ............ 109
What Is a Program? ..... .. . . ..................................... 109
Creating a Program ....................... ............. ...... .... 109
Running a Program ............................................. . 114
Program Memory ................................................ 116
The HP-41 C/ 41 CV and lnitial Confi.guration ...... . ...... ......... . . . 117
Flowcharting Your Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Problems ..... ..... ................................. . . .. . .... . . . 123
Section 8: Program Editing ........ . . . .... . ........................ . . 125
Editing Functions ............................................... . 125
lnitializing a Program ............................. . .. . ............ 127
Running the Program . ....... . . . . . ............................. . .. 128
Resetting to the Beginning of a Program ............................ 128
Single-Une Execution of the Program ............. . . . . . ........... . 129
Modifying a Program ... . ......................................... 131
Running the Modified Program .................................... 135
Deletin~ Correcting lnstructions ...... . . . ... .. .. ................ 136
Using ~ for Positioning . . . . . . . .. . . ..... . . . . . . .............. . . 140
The 1MCK 1 Function ........ . ..................................... 141
Problems ................. ... . . ... . .......................... .. . 141
Section 9: Program Interruptions ...... . . . . . . . . ...................... 145
Using lsroPI and IRtsl ...... .... ..................... . ........... 145
Using IPsel ..... ....... . . . . .... . ........................ ......... 147
Keyboard Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Error Stops ....... . . .... ...... . . .. ............... ... ............. 148
Problems ...................... . . ........ ....................... 148
Section 10: Programming With ALPHA Strings .......... ..... . . . . ..... 151
Using ALPHA Strings in Your Program ............................. 151
Problem ........... . ........... . ........... . . . ..... . ... . ........ 136
Section 11: Branching and Looping ................................... 159
Branching and Looping . ......... . ...................... . ... . ..... 159
Problems . ..... ....... . .... ...... . ....... .. ..................... 162
Contents 5

Controlled Looping .. ........ . . . .................................. 163


Problem ... .. . . . . ............................... . . . . . ... . ....... 168
Conditionals and Conditional Branches ..................... ...... . . 170
Problems ................... . ................................... 173
Section 12: Subroutines ............................................. 177
Subroutine Types and Label Searching ...... .............. ......... 178
Details of Subroutine Usage ....................................... 183
Subrouti ne Limits .. .... .... ...................................... 187
Local Labels . . .................................................. 188
Problems ........... . ...... . . .. . . ............................... 192
Section 13: lndirect Operations ...................................... 197
lndirect Store and Recall .......................................... 198
lndirect ALPHA Store and Recall .......................... . . . . . . . . 200
lndirect Function Control .......................................... 201
lndirect Control of Branches and Subroutines ....................... 203
Problems .......................... . ........... ... .... .. ........ 204
Section 14: Flags ..................................... . ............. 209
Problems .. ..................................................... 215
Flag Descriptions ................................................ 216
Problems ........... .. .. . .. . . .. . . ............................... 233
Appendix A: Accessories . ........ . .................................. 237
Appendix B: Maintenance and Service ................................ 239
Appendix C: Stack Lift Conditions and Termination of
Keyboard Entry .. .. ................................... 247
Appendix D: Program Memory Storage Requirements and
LAST X Operations .................................... 249
Appendix E: Messages and Errors . . . . . ............... . .............. 255
Appendix F: HP-41C/41CV Extensions .............. . ................. 257
Appendix G: Advanced Programming and Operation ................... 259
lndex .......................................................... . .. 262
Function Index ..................................................... 271
GRAO tums Shift key Cakulator is Calculator is
on while the has been in program mode. in ALPHA mode.
Cakulator is
cakulator is in pressed .
in USER mode.
grads trigonometric Digit tumed
mode. RAD tums on on indicates which
in radians mode . flag is currently set
(tlags O through 4 only).

lnput/Output Port Locations


HP-41C Only:
Memory enhancement. Using any port, plug
in one HP 82170A Quad Memory Module to
increase memory from the basic 63 registers to
the full 319 registers, or, beginning with port
1, plug in up to four HP 82106A Memory
Modules. Do not skip any ports when
inserting additional HP 82106A modules.
Each HP 82106A module contains 64
memory registers. Always remove memory
modules beginning with the highest numbered
port.

Module Limits and Remonl. HP 82106A


To remove: Execute:
Memory Modules cannot be used with the
HP 82170A Quad Memory Module. Since 1 memory module ISIZEl064
removing the quad module or a memory 2 memory modules ISIZE I 128
module from the cakulator reduces the 3 memory modules ISIZE I 192
number of data storage registers, you must be
4 memory modules
sure that there are enough data storage or the Quad lSIZE 1256
registers allocated to account for the registers Memory Module
you are removing.

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

Automatic Memory Stack Program Memory and Data Storage Registers

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,,,

;=====; ~ Movable memory partition. lni-


Top of Program Memory.
---.a..
-- tial allocation of memory is 46
registers to program memory
and the remainder ( 17 registers
in the HP-41C, 273 registers in
the H P-41 CV) to data storage.
This allocation can be changed
(the memory partition moved
up or down) using 1s1zE1. 1SIZE 1
specifies the number of registers
a llocated to data storage reg-
isters- the remainder are auto-
matically allocated to program
Program memory lines. memory. There are seven bytes
in each register of program
Each program should begin memory.
with an ALPHA label and end
with an END instruction. Press
1GTO 1O O before you begin
keying in a program.

Maximum of 15 ALPHA charac-


ters in any one program line.
Function key assignments of
c=i standard functions (not pro-
C:=J grams that you write) are stored
1 1 below unu se d pro g ram
memory.
Sb
USER Mode Keyboard

USER mode key toggles the HP-41 C into and


out of USER mode. In USER mode, the
functions on reassigned keys become active.
If a key is not reassigned , the normal mode
function (shown on the face of or above the
key) remains active.

~ (assign) is used to reassign the keyboard


for USER mode operation. The only key loca-
tions that cannot be reassigned are , ~ ,

-
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

ALPHA mode key places the calculator into - - - - - 1 1 - 1 & - - - - - - - - - - - - - - -.


ALPHA mode. Effective in normal , user or
program modes.

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.

1AACL I recalls the contents of the indicated



11
+

a 4 5


register and adds it to whatever is already in 2 3
*
the ALPHA register.
11
~ clears the display and ALPHA register.

The E3 key deletes the right-most character


from the ALPHA register. (Clears ALPHA
register and display if ALPHA entry has been
terminated .)

1Av1ew1 displays the contents of the ALPHA


register without disturbing the ALPHA or X-
registers.

Sa
Normal Mode Keyboard

Pressing a key executes the function shown


on the face of that key.

pressed before another key executes the


function shown above that key.

(!!ID (execute) is used to execute functions


and prograrns from the display. To execute TAN 1

and standard function , or a prograrn that is


stored in prograrn memory:
l. Press (!!ID . LBL GTO BST
2. Press 1A1.J1HA 1 and the prograrn or function
name. Press 1A1.J1HA 1.
The named function or prograrn will be exe-
cuted. lf the function expects pararneters,
then the calculator prompts for them.
r+-----t--~~ CATALOG

Pfme
ISG

11111111
RTN CLX/A

~ lists the contents of the function and


prograrn catalogs. Catalog 1 is the user cata-
log and it contains the global (ALPHA)
labels and END instructions of programs
stored in prograrn memory. The catalog is
positioned in memory to the displayed pro-
--
.X


-
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).

Views the conte nts of any register without


Deletes the right-most digit during digit or
disturbing the stack. To clear viewed data and
parameter entry . If digit entry has been
retum to the contents of the X-register, press
terminated, clears entire displ ayed X-
register. Also clears rnessages from the dis-
a .
play. Press @ill 10 clear the displayed
X-register. IfE3 is held down while HP-41C
is tumed on, does master clear.

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.

BAT USER G RAD SHIFT O 1 2 3 4 PRGM ALPH A

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.

To solve: Keystrokes Display


5 +6= 11 5 IENTERl 6 (J 11.0000
8 +2 = 4 8 IENTERl 2(!) 4.0000
7 - 4= 3 7 IENTER l48 3.0000
9 X 8 = 72 9 IENTERl 8@ 72.0000
19.852 19 .85 ~ 394.0225

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

q is the heat loss from the water heate r


(Btu per hour),
h is the heat-transfer coefficient,
A is the total surface area of the cylinde r,
and
T is the te mperature difference between
the cylinder surface and the
surrounding air.

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.

Programming the Sample Problem


The water heater in the example loses about 212 Btu every hour at the 15-degree
temperature difference. Suppose you decide to calculate the heat loss of the water al many
temperature differences. You could calculate the heat loss manual/y for each temperature
difference. Or an easier and fas ter method is to write a program that will calculate the heat
loss for any temperature difference .
Now let's write, load and run a program to do just that!

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.

Major Configuration Features


Continuous Memory. The HP-41 C maintains ali informat ion in the calculator in
Continuous Memory-one of the newest, most advanced memory systems avai lab le in a
scie nti fic calculator. Ali data, programs and func tions-everything in the calculator-
are maintained by Continuous Me mory while the calc ulator is tumed off. You can turn the
HP-41 C off, then back on and cont in ue working where you left off. In fact, to conserve
bauery power, the HP-41C turn s itself off after 10 minutes of inactivi ty.
Alphabetic/Numeric Capability. The HP-41C is one of the first ha ndheld sc ie ntific
calc ula1o rs to offer both a lphabetic and numeric characte r capabi lity . Alphabetic c haracters
allow you to na me and label programs and fun ctions, pro mpt for data with meaningful
words or sentences , display exact error messages, label variables and constants- even
display messages!
12 lntroducing the HP-41 C and HP-41 CV

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.

1USER1 Mode Key


The luseRI mode key allows you to customi ze you r HP-4 1C, plac ing functions where
you want them on the keyboard. When you press l useR I, the USER annunciator in the
display turns on to Jet you know the calc ulator is in USER mode. To take the HP-4 1C o ut
of USER mode, simply press lusER I agai n; the USER annunc iator will tum off. Try it now:

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.

1 ALPHA 1 Mode Key


ALPHA mode is an exc iting HP-4 1C feature that allows you to use both nu mbers and
le tters as well as several special characters. Whe n you press 1 ALPHA 1 , the prima ry keyboard
func tio ns become the alphabetic characters printed in blue on the lower face of the keys.
In additi on , the ALPHA annunciator wi ll tum on to show you that the calc ulator is in
ALPHA mode . To take the HP-41 C out of ALPHA mode, simply press 1 ALPHA 1 agai n.

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

The Owner's Handbook


Numbers s hown in most examples and proble ms in thi s handbook are dis played to four
decimal places. like thi s 0.0000. As you wi ll soon see, numbers can be dis played in a
variety of format s, but if you want the HP-4 1C d isplay to look like the o nes shown on the
next few pages, press [fil] 4 now.

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 .

~:::,..l.:~t------ To se lect the function above the key,


first press the gold (shift) key,
the n press the function key.

To select the function on the face of


the key, si mpl y press the key.

~L------ The c haracter printed in blue o n the


lower face of the key is only avail-
able in ALPHA mode, a nd not m
normal mode. ALPHA mode is
covered in detai l later.

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 .

The ALPHA Keyboard


When you place the H P-41 e into ALPHA mode ( 1 ALPHA 1 ) ' a special alphanume ric
keyboard becomes act ive. The characters printed in blue on the lower face of each key are
what you get when you press a key. The function s printed on the face and above the keys are
no longer active. In addition, an ALPHA character (not printed on the key) becomes
available as a sh ifted key. So, when the HP-41 C is in ALPHA mode ...
. . .the functi on printed above the key
is no longer active ...
. . .and the function printed on the
face of the key is no longer active.
A shifted ALPHA character is now
associated with the key (but not
printed on it) . To select the character
associated with this key, press
and the key (the shifted character on
the illustrated key is lower case b).
These shifted characters are shown
on page 19.
The primary func tion of each key is
now the ALPHA mode c haracter
printed in blue on the lower face of
each key. To select this character,
simply press the key.
Getting Started 19

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.

4 a nd 1 are shifted cha racte rs.


Blanks the di splay.
IALPHA I 0.0000 Takes calculator o ut of ALPHA
mode . The HP-41 C keyboard is no w
in " normal" mode; ali functions
printed above and on the face of the
keys are now active, and ALPHA
mode characters are no longer
available .

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):

Keyst rokes Display


. ICLXI 0.0000
6.0222 6.0222 _ The HP-41 C prompt s you for each
digit.
IEEXI 6.0222 Then prompts you for the exponen! .
2 6.0222 2_
6 6.0222 26 Avogad(o' s number (6.0222 X
10 26 kmol - 1) .
22 Getting Started

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.

The 1-1 (Correction) Key


You can delete one character at a time in the display using the E3 key . In ALPHA mode ,
each press of E3 deletes one right-most character. Notice how the " - " (underscore)
prompt moves back . For example:

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 _

-~ 25,600.0000 The an swer.

Now, to find the square root of that result :

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 :

Key in the number.


Execute the 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 .

1/25 0.0400 (25 ~)


V360 18.9737 (360@)
104 10,000.0000 (4 - ~ )
log 8.31434 = 0.9198 (8.3 1434I LOGI )
7 12 = 5,041 .0000 (71 C!:!l )

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.

For example, to add 15 and 5 :

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.

Other arithmetic functions are performed the same way :

To Perform Keystrokes Display


15 - 5 15 IENTER l 5 G 10.0000
15 X 5 15 IENTER I 5 0 75.0000
15 + 5 15 IENTER l 5 GJ 3.0000
26 Getting Started

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:

1. Key in the first number.


2. Press IENTERI to separate the first number from the second.
3. Key in the second number (the power).
4. Execute the function (press [l:) ).

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.

Let' s solve a problem using the [l:) function. Calculate 4 7 :

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:

164 (16 to the 4th power) = 65,536.0000 (16 IENTER I 4 . [l:))


2 15 (2 to the 1S1h power) = 32,768.0000 (2 1ENTER+I 15. (l:})
8 12 (8 1 squared ) 6,561.0000 (81 IENTERI 2 [l:))
(You could also have
done this as a one-
number function using
~-)

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

For example , solve (17 - 5) X 4.


lf you were working the problem with pencil and paper, you would ftrst calculate the
intermediate result of ( 17 - 5) ...

. . . and then you would multiply the intermediate result by 4.

(.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.

To Solve Keystrokes Display


(5 + 11 ) -;- 8 5 lENTER I 5.0000
110 16.0000
80 2.0000
(23 X 6) -;- 12 23 JENTERt J 23.0000
60 138.0000
120 11.5000
(9 + 17 - 4 + 23) -;- 4 9 JENTERt l 9.0000
170 26.0000
48 22.0000
230 45.0000
40 11 .2500

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:

First solve for


the contents of
these parentheses ... ... and then for these parentheses ...

.. .and then you would multiply the


two intermediate answers together.

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

0 66.0000 The final answer.

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

Before You Continue ...


Now that you've leamed how to use the basic features of the calculator, you can begin
to full y appreciate the benefits of the Hew lett-Pac kard logic syste m. With thi s system , you
enter numbers using the paren thesis-free, un ambiguous method called RPN.
lt is the RPN system that gives you ali ofthese advantages whi le you are using the HP-41C:
You work with o nly one function at a time . The HP-41 C cuts proble ms down to
size instead of making the m more complex.
Functions are exec uted immedi ate ly . Yo u work naturall y through complicated
proble ms, with fewe r keystrokes and less time spent.
lntermediate results appear as they are calculated . There are no " hidden" calcu-
lations , and you can check each step as you go.
lntermediate results are automatically handled . You don' t have to write do wn lo ng
interrnediate answers when you work a proble m.
You can calc ulate in the same manner you do w ith pe nci l and paper. You do n' t
have to th ink the problem through ahead of time .
There is no need to worry about parentheses in the calcula tio n; RPN e liminates
the necess ity for ente rin g parentheses.
The Hewlett-Packard RPN system takes jusi a few minutes to leam . But you' ll be amply
rewarded by the ease with which you and your calcula to r will glide th rough the longest ,
most complex equations . W ith the HP-41 C, the in vestment of a few moments of leaming
yie lds a lifetime of mathematical dividends. Work carefully thro ug h thi s handbook so you
can get the greatest value from your new HP-41 C .
Section 2

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:

2.000000000 X 10 00 0 3. 141 592654 X 10 0

y ie lds an answer that is actua ll y carried to full 1O d ig its intem all y:

__,_.._,,__
6. 283 185308 IO X

Yo u see o nly these d ig its ... / ' ... but these di g its are also present intem ally.

Display Format Control


There are three functions, (II!J , f!E:D , and 1ENG1 , that allow you to control the manner in
which numbers appear in the HP-41C display.
(II!J d isplays numbers in fi xed decima l point format, whi le f!E:D permits you to view
numbe rs in sc ientific no tatio n format. IENGI displ ays numbers in eng ineering notati on , w ith
expone nts o f 10 shown in multiples o f three (e.g., 103, I0- 6 , 10 12 ). By pressing a d ig it
key (0 through 9) after any o f these display control fun cti o ns, you spec ify the number
of decima l digit s dis played . The HP-4 1C will actu all y prompt you with an - (underscore)
for the number (0 through 9 ) when you press the di splay formal fun cti o n .
No matter which f ormar or how many digits you choose, display control alters only the
31
32 Display Control

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.

Fixed Point Display


Us ing fixed point dis play , you can specify the number o f pl aces to be shown after the
dec imal point. lt is selected by press ing lII!:J fo ll owed by a numbe r key to specify
the number of decimal places (0 through 9) after the decima l point. T he HP-4 1C w ill
prompt you with F/X _ to let you know th at you must nex t e nter a di g it.
10-digit number

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.

Scientific Notation Display


In scientific notation each number i s displayed with a single digit to the left o f the deci mal
point. Thi s number is followed by a specified number of digits (up to 7) to the ri ght o f
the dec imal point and multipl ied by a power o f 10. T he calcul ator prompts you for the
decimal digit spec ification with SC/ -

Sign ----1~ ...1---- Exponen! of 1O

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

Engineering Notation Display


Engineerin g notati on is similar to scienti fic notation except that engineering notati on shows
ali exponents as multiples o f three (e.g., 103, 10- 0 , 10 12 ) .

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.

Multiplier Prefix Symbol


1012 tera T
109 giga G
106 mega M
103 kilo k
10 3 milli m
10 6 micro
10 9 nano n
10 12 pico p
10 15 femto f
10- 18 atto a

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.

Automatic Display Switching and Scrolling


The HP-41 C automat ically sw itches the di splay from fixed point no tatio n to scientific
notation whenever the numbe r is too Ia rge or too s mall to be seen with a fixed decimal
point. This keeps you fro m mi ssing unexpectedly Iarge o r sma ll answers.
36 Display Control

After automaticall y switching from fixed point to


scienti fic notation , the display automaticall y revert s
back to the fixed poi nt display orig inall y selected
when new numbe rs come into the display. Note that
automati c switching occ urs onl y between fi xed and
scienti fic notation displays-eng ineering notation
display must be selected wi th the IENG I .
Any time the HP-41C must display a single line of
information which exceeds the 12-character dis-
play, the calculator automatically "scrolls" the line
through the display to the left so that you can see the
complete line.

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.

BAT USER GRAD SHIFT O 1 2 3 4 PRGM ALPHA

BAT (Battery) Low Power Annunciator


If the BAT annunciator is displayed , this mea ns that you ha ve about 5-15 days of operating
time left (using alkaline batteries). The best thing to do when BAT turns on is to put HP-41C
batteries on your shopping Jist. (Refer to Batteries, page 240) .

USER Mode Annunciator


Whe n you press the lusER I key to set the HP-41C to USER mode, the USER annunc iator
in the di splay tu ms on. This lets you know that your customized keyboard has become
ac ti ve. Functions th at you have assigned to the keyboard become acti ve and the normal
functi ons on those keys are no lo nge r acti ve. For an introductory discussion of USER
mode , tum to Ope rat ing Keys on page 15. USER mode is covered in detail in section 4 .

GRAD-RAD Mode Annunicator


When you execute the IGRADI function, the HP-4JC is placed in GRADs trigonometric
mode and the GRAO annunciator tums on . When you execute the IRADI function , the
HP-41 C is placed in RADi ans mode a nd the RAD portion of the di splay annunciator tums
on . Function exec ution is covered in section 4 and trigonometric modes are covered in
deta il in section 6 .
Display Control 37

01234 Flag Status Annunciators


lf fl ags O, 1, 2, 3, or 4 are set in a prog ram or from the keyboard, the corresponding
display annunciator tums on. A flag annunciator showing in the display indicates a set
(true) flag. Don't worry about flags yet- they are covered in detail later in this handbook.

Shift Key Annunciator


Any time you press the (shift ) key, the SHIFT annunciator tums on. The annunciator
tums off again when you press or the shifted func tion is executed.

PRGM (Program) Mode Annunciator


Pressing IPRGMl places the HP-41C into PRGM (program) mode and tums on the PRGM
di splay annunciator. Pressing IPRGMl again takes the catcula tor out of PRGM mode and
tums off the annunciator. PRGM mode and programming are covered in part 11 of thi s
handbook , so don ' t be concemed about the PRGM annunciator now.

ALPHA (Alphabetic) Mode Annunciator


When you place the HP-41C into ALPHA mode by pressing 1ALPHA1, the ALPHA
annunciator tums on. When the ALPHA annunciator is tumed o n, you are assured that the
ALPHA keyboard is active. The ALPHA keyboard was covered in section 1, pages 18-20.

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

Automatic Memory Stack and ALPHA Register

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 Automatic Memory Stack


Automatic storage of intermediate results is the reason that the HP-41C makes solution of
even the most complex equations simple . The automatic storage is made possible by the
Hewlett-Packard memory "stack."
Here is what the registers of the automatic memory stack look like:

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)

The Display and ALPHA Register


We have just seen how you can execute a function and how the res ult is placed in the
X-regi ster and seen in the display.
But if you are in ALPHA mode, any characters you key in are placed into a special ALPHA
register as well as the di splay . The ALPHA regi ster is separare fro m the automatic memory
stack. The automatic memory stack is not disturbed when you key in ALPHA cbaracters.
To see what is in the ALPHA register, simply place the HP-41C into ALPHA mode. In
ALPHA mode , the ALPHA register is a lways displayed.
The ALPHA register can hold up to 24 characters, 12 more than the display. In any
combination of full characters and periods, colons and commas, the largest number of
c haracters you can place in the ALPHA register is 24.
When you key in a string of ALPHA characters longer than the display (12 characters) , the
HP-4 1C automatically "scrolls" the characters through the dis play to the left. If at any
time you wish to see the complete contents ofthe ALPHA register, simply press 1AVIEW1
(A LPHA vi ew) in ALPHA mode .
Try it now:

Keystrokes Display
I ALPHAI

SCROLL EXAM SCROLL EXAM _ Watch how the HP-41C scrolls


p CROLL EXAMP _ characters off the left of the display.
L ROLL EXAMPL _
E OLL EXAMPLE _
IAVIEWI SCROLL EXAMP 1 Av1ew 1 lets
you view the entire
CROLL EXAMPL string any number of times.
ROLL EXAMPLE
Blanks the display.
0.2000 The X-register is again displayed .

The IAPPENDI function (. K in ALPHA mode) enables you to build on to a string in the

placing the HP-4 JC into ALPHA mode , pressing IAPPENDI


desired additional characters .
<
ALPHA register. You can add characters to a string already in the ALPHA register by
K) and then key in the
Automatic Memory Stack and ALPHA Register 41

Try using IAPPENDI now:

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

Function Names and the Display


Each time you press and hold a function key for a moment, a name describing that func tion
appea rs in the display. When you release the key, the name goes away a nd the function is
executed .
lf you press and hold a function key for Ionger than about a half second , the name wi ll
appear, and the n will be replaced by the word NULL. NULL indicates th at the function has
been null ified a nd wi ll not be executed when you release the key . This allows you to preview
function names and quic kly recover from keystroke erro rs.
Keys that you use to key in numbers (1CHS 1, 1EEX1 , [!] a nd O through 9) a nd ALPHA
characte rs do not prompt with a na me in the di splay . These keys execute whe n the key is
pressed - they cannot be nullified .

Clearing the ALPHA- and X-Registers


You can clear the contents of the ALPHA register in ALPHA mode by pressing 1CLA1 .
1CLA1 ( clear ALPHA ) clears the ALPHA register and leaves the automatic memory stack
intact.
42 Automatic Memory Stack and ALPHA Register

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)

Editing Display Entries


The 8 (correction) function lets you "back up" when you have made an error. Simply
stated , any time you make an error and you want to remo ve numbers or ALPHA characters
(ALPHAs) you keyed in , or numbers left by a function, press 8.

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).

And to clear a function requiring input:

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

Manipulating Stack Contents


The ~ ( r ol! down), ~ ( rol! up), and l x ~YI (x exchange y) functions a llow you to
rev iew the stack conte nts or to move data within the stack fo r computati on at any time.
Note that ~ is one HP-4 1C function that is not on the keyboard. lt is executed from the
display or assigned to a key for execution . Execution of func tions from the di splay and
assigning func tions to keys is covered in section 4 .

Reviewing the Stack


To see how the ~ func tio n works, first key in the numbers 1 through 4 :

Keystrokes Display
4 I E~ I 4.0000
31 ~ 1 3.0000
2 1 ~ 1 2 .0000
1_

So the stack now Iooks li ke this:

T 4.0000
z 3.0000
y 2.0000
X 1_ (Displayed)

Now press ~ :

Keystrokes Display
~ 2 .0000

T he stack now looks like this:

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

The stack now looks like thi s:

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 . ..

... trom ths ... ... to this.

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 .

The 1ENTER+ I Key


When you key numbers into the calculator, you must tell the calculator whe n you have
fi nished keying in one nu mber and are ready to key in the next number. You do this usi ng the
l ~ I key.

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 ...

... from this ... ... to this.


T 4.0000 _____.,. T 3.0000
z 3.0000 _____.,. z 1.0000
y 1.0000 ~y 2.0000
X 2.0000 __.- X 987.3000

Then, when you press l ~ I, the number is pushed into the Y-register. The contents of
the stack are then c hanged ...

... from this ... . .. to this.


T 3.0000 _____.,. T 1.0000
z 1.0000 _____.,. z 2.0000
y 2.0000 y 987.3000
X 987.3000~ X 987.3000

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.

Clearing the Stack


1CLST 1 (clear srack ) clears each of the automatic memory stack reg isters to zeros. 1CLST1 can
either be executed from the display or assigned to a key location and exec uted by pressing
that key in USER mode. 1CLST1 is most useful if it is ass igned to a key for USER mode
executio n. USER mode and display execution are both covered in section 4.

One-Number Functions and the Stack


One-number functions operate upon the number in the X-register only. The contents of the
Y-, Z-, and T-registers are not affected when a one-number function is executed.
For example, key in the follow ing numbers and execute the @J func tion:

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

Here is what happens when you executed the @ function :


First , after you keyed in the numbers, the stack looked Iike this (the T- and Z-registers are
shown cleared to zero for clarity):

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.

Two-Number Functions and the Stack


The HP-41 C performs arithmetic operations by positioning the numbers in the stack the
same way you would on paper. For instance, if you wanted to add 17 and 46 you would
write 17 on the paper and then write 46 undemeath it , like thi s:
17
+46

and then you wou ld add , like this:

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.

Keystrokes Stack Contents


. iCLXj 0.0000
21 T 0.0000 21 is keyed in.
z 0.0000
y 0.0000
(Displayed) X 21-
IENTER I T 0.0000 2 1 is copied in to Y .
z 0.0000
y 21.0000
(Displayed) X 21.0000
38 T 0 .0000 38 is keyed in.
z 0.0000
y 21 .0000
(Displayed) X 38 _
(IJ T 0.0000 38 and 21 are added together.
z 0.0000 The answer, 59, is in X and the
y 0.0000 display .
(Displayed) X 59.0000
19 T 0.0000 19 is keyed in and the 59 is
z 0.0000 automatically raised into Y.
y 59.0000
(Oisplayed) X 19 _
50 Automatic Memory Stack and ALPHA Register

Keystrokes Stack Contents


G T 0.0000 59 and 19 are added togethe r.
z 0.0000 The answer, 78, is in X and the
y 0.0000 display.
(Displayed) X 78.0000
53 T 0.0000 53 is keyed in and the 78 is
z 0.0000 automaticaJly raised into Y .
y 78.0000
(Displayed) X 53 _

G T 0 .0000 78 and 53 are added together.


z 0.0000 The final answer, 131 , is in X and
y 0.0000 the display .
(Displayed) X 131.0000

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 = ?

Keystrokes Stack Contents


21 T 0.0000 21 is keyed in .
z 0.0000
y 0.0000
(Displayed) X 21-
IENTER+ I T 0.0000 2 1 is copied in to Y.
z 0.0000
y 21.0000
(Displayed) X 21.0000
38 T 0.0000 38 is keyed in .
z 0.0000
y 21.0000
(Displayed) X 38-
Automatic Memory Stack and ALPHA Register 51

Keystrokes Stack Contents


IENTERI T 0.0000 38 is entered into Y.
z 21 .0000 21 is lifted up to Z.
y 38.0000
(Displayed) X 38.0000
19 T 0.0000 19 is keyed in.
z 21.0000
y 38.0000
(Displayed) X 19 _
IENTER I T 21.0000 19 is copied into Y.
z 38.0000 21 and 38 are lifted up to T and Z
y 19.0000 respectively.
(Displayed) X 19.0000
53 T 21.0000 53 is keyed in.
z 38.0000
y 19.0000
(Displayed) X 53-
m T 21 .0000 19 and 53 are added together and the
z 21 .0000 re st ofthe stack drops . 2 1 drops to Z
y 38.0000 and is a lso duplicated in T. 38 and 72
(Displayed) X 72.0000 are ready to be added.
m T 21 .0000 38 and 72 are added together and the
z 21.0000 stack drops agai n . Now 21 and 110
y 21.0000 are ready to be added .
(Displayed) X 110.0000

m T 21.0000 1 1Oand 2 1 are added togethe r for the


z 21.0000 final answer and the stack continues
y 21 .0000 to drop.
(Displayed) X 131.0000

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:

{ 37X [ (5+ 18)+(5X . 13)]} + 3.87

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.

Recovering From Mistakes


1LASTx1 makes it easy to recover from keystroke mi stakes, such as exec uting the wrong
fun ction or key ing in the wrong number. For example , divide 287 by 13. 9 after you have
mistakenly divided by 12.9 .
Automatic Memory Stack and ALPHA Register 53

Keystrokes Dis play


287 IENTER I 287.0000
12.9 GJ 22.2481 Oops! The wrong number.

, LASTX j 12.9000 Retrieves the last entry .


0 287.0000 You are back at the beginni ng.
13.9 GJ 20.6475 The correct answer.

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 ...

... from this ... ...to this ... ...to this.

T 0.0000 T 0.0000 T 0.0000


z 0.0000 z 0.0000 z 0.0000
y 287.0000 y 0.0000 y 22.2481
X 12.9000-.GJ - X 22.2481_.. L ASTX f / X 12.9000
~---___,-LAST X 12.9000 --------~
Recovering a Number for Calculation
The LAST X register is useful in calculat ions where a number occurs more than once. By
recovering a number using 1LASTx I, you do not have to key that number into the calculator
again .
For example , calculate

96. 704 + 52 . 394706


52 .394706

Keystro kes Display


96.704 1ENTER I 96.7040
s2.3947o6 G 149.0987 lntermediate answer.
, LASTX f 52.3947 Recalls 52 .394 706 to the X-register.
GJ 2.8457 The answer.

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

Example. A bacteriologist tests a certai n strain


whose populati on typically inc reases by 15% each
day (a growth fac tor of 1. 15). If he starts a sample
cultu re of 1000, what wi ll be the bacte ria popul a-
tion at the end of each day for fi ve consecuti ve
days?

Method : Put the growth factor ( 1.15) in the Y-,


Z-, and T-registers and put the orig inal populati on
( 1000) in the X-register. Thereafter, you get the
new da ily population whenever you press 0 .

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

(This page intentionally left blank.)


POWER

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 .

Executing Functions From the Display


Here is how it is done. Let's compute the factorial (1FACT1) of 6. 1FACT1 is one of the
functions not available on the normal keyboard.
To beg in , key in the number 6 and press lxeal. When you press lxeal , the HP-41C will
place the word XEQ and - (underscore) prompts in the display, like thi s:

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 .)

For example , set the calcu lator to ~ 6 .

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

Function Editing and Correction

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

The ICATALOGI Function


Yo u can list the conte nt s of any of the HP-41C catalogs by pressi ng ICATALOG) . The
calculato r then prompts you for o ne of the followi ng catalog numbers:

The User Catalog ~l


The Extension Catalog ~ 2
The Standard Function Catalog ~ 3

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:

The User Catalog ( 1) By top-to-bottom order in prog ram memory.


Newest prog ra ms at the bottom.
The Extension Catalog (2) Grouped by exte nsion .
The Standard Fu nction Catalog (3) Alpha bet ical .

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

Stopping the Catalog Listing

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 .

0.0000 Press 1R/S1 to stop the cata log


listing, then pre ss and hold 8 to
term inate 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.

USER Mode Functions


You may re member from the brief descriptions in secti ons 1 and 2 that USER mode allows
you to customi ze your HP-41 C . USER mode le ts you place functions on the keyboard where
you want them. The way thi s is accomplished is through the use o f the I ASN I (assign)
function . Using 1ASNI , you specify a functi on name and a keyboa rd locatio n for that
functi on name. Once a function is assigned to a keyboard Jocation, ali you do to execute it is
to place the HP-4 1C into USER mode and press the reassigned key.
62 Using the Standard Functions

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.

Returning to the Normal Mode Function


To reassign a key to its original normal mode func tion , simply press IASN 11 ALPHA 1
1 ALPHA 1 and that key . For example, in section 1, you assigned a HEAT program to the [f!J
key. To retum the [f!J function to that key:

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.

Using Reassigned Functions


Any function you have reassigned to a key location may be used when the HP-41C is
placed into USER mode. Whe n you press luseRI, aJI functions you have assigned or
reassigned to the keyboard become active. The standard func tions located in those key
locati ons are no longer avai lable . lf a key location has not been reassigned, it retains its
normal func tion in USER mode.
Le t' s try a sample proble m. In the previous example, you assigned the IMEANI function to
the @J key.
Cross-country runner Joel Di mor is training for a 26-
mile marathon in Mexico C ity. Joel knows that the
pace he sets for the race will det ~rmine how well he
holds up in the final miles. He decides to run 10
miles five different times to see how well he paces
himself. Below is a summary of the timings from
the five runs .
64 Using the Standard Functions

1st 2"d 3rd 4th 5th


10-Mile 10-Mile 10-Mile 10-Mile 10-Mile
Run Run Run Run Run
Timing in Minutes 52.60 53.55 51 .25 50.65 48.76

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

Storing and Recalling N umbers and ALPHA Strings


The HP-41C comes standard with 63 storage registers. You can add memory
modules to increase the number of registers to a total of 319. The HP-41CV comes
standard with 319 registers and does not use memory modules.
Program memory uses registers for storing program instructions. Later in this section
you will learn how to control the allocation of memory to data storage registers and
program registers. When master clear is executed, the HP-41 Chas 17 primary data
storage registers and 46 program memory registers; the HP-41 CV has 100 primary
data storage registers, 173 extended data storage registers, and 46 program memory
registers.
The data storage registers allow you to store and recall numbers and ALPHA strings
for use in later calculations or in programs. These registers are independent of the
automatic memory stack and LAST X registers and can be accessed either from the
keyboard or by instructions in a program. Ali information in the storage registers is
preserved by Continuous Memory.
The diagram below shows ali potential data storage registers, i.e., the maximum
memory allocation to data storage registers. (Remember: The HP-41CV has the full
capacity illustrated below; the HP-41 Chas up to 63 primary registers unless you add
additional memory modules.) The addresses of the primary storage registers are
indicated by the numbers 00 through 99. The address of the extended storage
registers are indicated by the numbers (100) through (318).
Automatic Primary Extended
Memory Data Storage Data Storage
Stack Registers Registers

[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:

Standard A00_ 6 2, and or,


Module 1: A 63 _ 99, A 1100- 1261 Module 3: A 1191 _ 2541 Quad Memory Module:
Module 2: A 1121- 1901 Module 4: A 12 55 _ 3 181 Ae3- 9g,A1100- 31s.

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).

Primary Storage Registers


Storing Numbers
To store a num ber th at is in the X-register into any primary storage regi ster (00 th rough
99):
l. Press (sro l. The HP-4 1C will prompt you for the address number with STO __ .
2 . Press the number keys of the applicable register. address (00 through 99). Address
numbers must be 2 digit s, e.g., 01 , 02, or 50. The operation is performed when you
en te r the second digit .
For example, to store 2,200,000 (the distance in
ligh t-years of the Great Spiral Galaxy in An-
dromeda from Earth) in register R 12 :

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.

Storing and Recalling in Stack Registers


Using the HP-41 C, you can even store and recall numbers into and from the stack and
LAST X registers. Ali you have to do is press 8 (decimal point) and X, Y, Z, T , or L (for
LAST X) as the register address. When the HP-41 C prompts you for the address, simply
press the associated letter key (X, Y, Z, T , or L)-there is no need to enter ALPHA mode.
For example, to store the number 19 into the Z-register 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

Now, recall the val ue from the Z-register:

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

Storing ALPHA Strings


ALPHA strings that you ha ve placed in the ALPHA-register can be stored into any storage
registers, even into the stack registers . (An ALPHA string is a series of ALPHA charac-
ters .) In ALPHA mode, the shifted functions on the lsTol and IRCLI keys are the IAsTol
(A LPHA store) and 1ARCL1 (A LPHA recall) functio ns. Ali you do is press 1ASTO1 or
, ARCL 1 and specify the register address. The HP-41 c prompts you with ASTO __ a nd
ARCL_ _

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.

Recalling ALPHA Strings


Now, to recall an ALPHA string that is stored in any storage register: (Remember,
1ARCL1 does not disturb the stack , it only brings strings into the ALPHA register. )
l. In ALPHA mode, press lARCLI (press . IRcLI in ALPHA mode) . The HP-41C will
prompt you for the address with ARCL __ .
2. Key in the desired register address (00 through 99).
Storing and Aecalling Numbers and ALPHA Strings 71

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

ALPHAs and the Stack


Stack registers and LAST X can be specified as 1ASTO1 and 1AACL1 register addresses. Any
time you wish to spec ify a stack register or LAST X asan address, simply press 8 (deci-
mal point) and the desired register letter key (X, Y, Z, T , or L) in response to the function
prompt. For example:

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

Now, recall the string:


Keystrokes: Display:
ARCL __
ARCL T Contents of stack register T are
ENERGY _ recalle d into the displayed ALPHA
register. Hold the T key dow n for a
moment to see the ARCL T prompt.
0.0000 Returns to norm al mode and clears
the di splayed X-register.

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 .

6.8000 94 The o rig inal nwnber is in X.

Defining Storage Register Configurations


As you read at the beginning ofthi s section, you can control the amount of HP-4 1C memory
that is allocated to both data storage reg iste rs and program memo ry. The 1SIZE 1 func tion
a ll ow~ you to specify the number of data storage regi ste rs you wish to have a llocated .
When you exec ute 1SIZE l. the HP-41 e prompts you fo r a three-d igit number from 000
through 319.
lf you attempt to increase the all ocation of sto rage regi sters and there is not e no ugh unused
space in program memory for this increase, the HP-41 C wi ll di splay PACKING and then
TRY AGAIN. Afte r you execute 1SIZE J again , if the HP-4 1C again di splays PACKING and
TRY AGAIN, this means that the rea llocation is not possible until program instructions a re
de leted from program memory.
lf you decrease the allocation of data storage regis te rs , any information in reallocated data
s to rage registers wi ll be lost.
Any atte mpt to store o r reca ll usi ng a storage register th at is not in the current a llocation
will result in the NONEXISTENT message in the dis play . For example. if the HP-41 Chas 17
storage registers allocated (R 00 through R 16 ), lsTO ) 55 will result in the NONEXISTENT
display.

Clearing Storage Registers


E ven though you ha ve recalled or viewed the contents of a storage reg ister, the number or
string also remains in the storage register. You can c lear storage registers in three ways:

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 .

Storage Register Arithmetic and the Stack


You can also spec ify the stack or LAST X registers for storage register arithmetic by
simply pressing 8 (decimal point) and X, Y, Z, T, or L (for LAST X) as the register
address. For example, place the number 50 in the X-register and add the number to itself:

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.

Storage Register Overflow


lf you attempt a storage register operation that would cause the magnitude of a number in
any of the storage registers to exceed 9. 999999999 x 1099 , the operation is not performed
and the HP-41 e display immediately indicates OUT OF RANGE . When you press B' the
error condition is cleared and the last value in the X-register before the error is displayed.
The storage registers and the stack ali contain the values they held before the error-causing
operation was attempted.
For example, if you store 7 .33 x 1052 in R0 1 and attempt to use storage register arithmetic to
multiply that value by 105 , the display will show OUT OF RANGE

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

The Standard Function Catalog


The HP-41 C has over 130 intema l functions that allow you to compute answers to problems
quickly and accurately. You can list this set of functio ns at any time by pressing ICATALOGI
3.
This secti o n gives a brie f explanation of most HP-41C standard func ti ons (except
prog ramming functions, which are presented in part 11 ) along with sorne example
pro ble ms. Ali ofthe func tio ns in thi s sectio n can be stored and executed in program memory
as part of a user program unless otherwise noted. Re member, execution o f ali func tio ns not
on the keyboard is simple when you assign the func tion s to the USER mode keyboard for
execution (refer to secti on 4 ).

General Mathematics Functions


Changing the Sign of a Number
To key in a negative number, press the keys for the number, then press lcHsl (change
sign). The number, preceded by a minus (-) sign , will appear in the display . You can
also change the sign of either a negative or positi ve nonzero number in the display by
pressing lcHsl. For example, key in 2 .54 and cha nge the sign of the number.

Keystrokes Display
2.54 2.54 _ The number.
lcHsl -2.54 _ The sign is cha nged .
ICHSI 2.54 _ Sign is changed back again .

To change the sign of an exponen! of a number, you


must use 1CHSI immediately after keying in the
exponen! (before you perform sorne operation that
terminares digit entry ). As soon as digit entry is
terminated , 1CHS1 changes the sign of the mantissa
of the number, not the exponen!. For example, key
in the Rydberg constan! ( 1.0973731 x 107 , a
universal constan! used in s pectroscopy) and
change the sign of the expone n! .

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

To compute the absol ute value of + 3:


Keystrokes Displ~y

lxeol XfQ __
i ALPHA 1 ABS i ALPHA 1 3.0000 1+31.

lnteger Portion of a Number


To extract and di splay the integer portion of a number, execute o:E!J (integer). For
example, to extract only the integer portion of the number 123.4567 :

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.

Fractional Portion of a Number


To extract and display only the fractional portion of a number, execute the 1FAC 1(fraction)
function. For example, to extract only the fractional portion of the number 123.4567
used above:

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.

The Modulo Function (Remainder)


Executing [Mool (modulo) performs y mod x (the equation is y-( < y/x> X x], where < >
denotes the largest integer less than or equal to the indicated result), which divides y by x
and gives the remainder of the division . So, when you place numbers in the X- and
80 Functions

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 .

Perforrning y mod x when x= O returns an answer o f y.

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

Fi nd the square root of 16 using the @ key on the keyboard:

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: ~

For example , find the square of 27 using the keyboard ~ function:

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 __

The up-arrow is on the sh ifted N


key in ALPHA mode (on IENTER I
key) .
531,441.0000

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:

1. Key in the base number.


2. Press ENTER I .
1

3. Key in the num ber represent ing the percent rate.


4 . Press OO .
Example : About 94% of the weight o f a tomato is water. lf a partic ula r tomato weighs
500 grams, what a mount of the weight of the tomato is water?

Keystrokes Disp lay


500 500 _ The base nurnber.
IENTERI 500.0000
94 94 _ The percent o f water.
oo 470.0000 The weight in grarns o f water in a
500-grarn tomato.

When you executed 00 , the stack conte nts were changed ...

... from this ... ... to this .

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 .

3. Key in the second number.


4. Execute the IY.cHI functio n from the display. Percent of change is calculated as
%CH = [ (x - y) 100J . ;. . y. (When y = O a value of 9. 999999999 x 1099 is placed
in the X-reg iste r and the calculator di splays OUT OF RANGE .)

Example: Tomato grower Flem Snopes has found


that he can decrease the amount of water in the
tomatoes he is grow ing. His typical tomato weighs
about 500 grams. He has found th at o nl y 430 grams
of the total weight is water, compared to 470 gra ms
of water in the to mato from the previous example.
What is the percent of change of water amount
between the average to mato and Snopes' tomato?
Functions 85

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 .

lf the value in X is ALPHA charac1ers, 1SIGN 1 re tum s O 10 X .


lf the value in X is less than zero (negati ve), 1SIGN 1 returns - 1 to X .
lf the value in X is zero, 1S1GN 1 re1ums 1 10 X .
lf the va lue in X is grcater tha n zero (positi ve), 1SIGN1 re tum s 1 to X .

T he o riginal value o f X is preserved in LAST 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

To see the RAD and GRAO annuneiators in the display ...

Keystrokes Dis play


l xeo l XEQ __
i ALPHA j RAD i ALPHA 1 -8.5106 Not iee that the RAO annune iator
tums o n. (The nu mber in the dis play
remains from the previous example.)

-- 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

Note: 360 degrees = 21T radians = 400 grads

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.

ext, find t.he tangent of 43 .66 grads.


Keystrokes Display
lxEo l XEQ __
( ALPHA 1 GRAO i ALPHA i 1.3017 The HP-41C is now in grads mode
and the GRAO display annunciator
is on. Number remains from pre-
vious example.
43.66 43.66 _
ITANI 0.8183
lxEo l XEQ __
1 ALPHA 1 OEG 1 ALPHA 1 0.8183 Sets the HP-4 1C back to degrees
mode.

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

Hours, Minutes, Seconds/Decimal Hours Conversions


Using the HP-4 1C, you can change time specified in decimal hours to hours, minutes,
seconds format by executing the !HMSI (decimal hours to hours, minutes, seconds)
function. You can a lso change from hours, minutes, seconds to decimal hours by executing
the ~ (hours, minutes, seconds to decimal hours) function . Both of these functions
are executed using 1XEO1 or assigned to a key for exec ution in USER mode.
When a time is displayed in hours, minutes, seconds formal , the digits specifying hours
occ ur to the left of the decimal point, while the digits specifying the minutes, seconds, and
fractions of seconds occur to the right of the decimal point.

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.

Example: Convert 19.34 decimal degrees to degrees, minutes, seconds.

Keystrokes Display
19.34 19.34 _ The ang le.
IHMSl (~) 19.2024 This means 19 degrees, 20 minutes,
24 seconds.

Example: Convert 9 degrees, 9 minutes, 59. 3 seconds to its decimal equivalent.

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

Adding and Subtracting Time and Angles


To add or subtract decimal hours, merely key in the numbers for the decimal hours and
press (] or G . To add hours, minutes, seconds, use the IHMS+I (add hours, minutes,
seconds) or IHMS-1(subtract hours, minutes, seconds) function . Both of these functions are
executed using 1XEO1 or by assigning them to a key for execution in USER mode.

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.

Example: Lovesic k sailor Osear Odysseus dwe lls


on the island of Trist an da Cu nha (37 03' S,
12 18' W), and his sweetheart , Penelope, lives on
the nearest island . Unfort un ate ly for the course of
true )ove, however, Tristan da Cunha is the most
isolated inhabitated spot in the world . lf Pe ne lope
Ji ves on th e isla nd o f St. He le na ( 15 55 ' S,
5 43' W), use the follow ing formula to calculate the
great ci rcle di stance that Odysseus must sail in order
to court he r.

Distance = cos- 1 [ sin (LAT5 ) si n (LATd) + cos (LAT5 ) cos (LATd)


cos (LNGd - LNGs)] X 60

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

Polar/Rectangular Coordinate Conversions

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

In the HP-41 C, angle 8 is represented in the follo wing manner:

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):

1. Key in the y-coordinate.


2. Press 1EH'ml l.

3. Key in the x-coordinate.


4. Execute IR-P i ( r ectang ular to p olar). Magnitude r is placed in the X-register and
angle 8 is placed in the Y-register. To d isplay the 8 value , press 1x ~ Y I .

Whe n you exec ute the IR-P i func tion, the stack conte nts are c hanged ...

... from this ... ... to this.


T T
z z z z
y y-coordinate ~ Y
ro::ni - - angle 8
X x-coordinate~ ~ __. X magnitude r
94 Functions

To convert from polar (r, 8) coordinares to rectangular x, y , coordinates:


1. Key in the value for the angle .
2. Press 1ENTER J .

3. Key in the value for the magnitude r.


4. Execute IP-RJ (polar to rectangular). The x-coordinate is placed in the X-register
and th~oordina te is placed in the Y-registe r. To display the y-coordi nate value,
press ~ .
When yo u execute the 1P-R 1function, the stack contents are changed .. .
... from this ... ... to this .

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

Logarithmic and Exponential 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.

Natural log Display execution: 1 LNt+x 1 Computes In ( 1 + X), where X is a


(for argume nts close numbe r very close to zero. 1 LN1+x 1
to one) provides greater precision than
~ whe n you are fi nding th at the
natural log of numbers c lose to
one. Example: To find the natural
log of ( 1 + 4 . 25 x 10- 6 ), key in
4 .25 X 10- 5 and execute 1LN1+x l.
An swers are di splayed in ~
formal .

Natural antilog Display execution: 1Etx- 1 1 Computes (ex) - 1, where X is a


(for arguments close n u m ber ve ry e lose to zero.
to zero) 1Et x- 1 1 provides g reater prec is ion
than ~ for numbers very close to
zero. Examp le: To calc ul a te
(e4.2s x io- 6) - 1, key in 4.25 x
J Q- 6 a nd execu te 1Etx-1 l.
An swers are di splayed in ~
formal.
Functions 97

Let's work a n example usi ng 1LOGI . The village of


Musser has ins talled a 12-o' clock whistle in the
firehouse steeple ne ar the center of the village. lf the
sound leve l at the steeple (2.2 meters from the
whistle) is 138 decibels. will residents near the edge
of the town . three k ilometers away, be a ble to hear
the lunch whistl e? The equatio n giving the sound
level at the edge of tow n is:

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) .

Keyst rokes Display


3000 i ENTERt i 3,000.0000
2.2 0 1,363.6364
ILOGI 3,1347
200 62.6940
lcHsl -62.6940
13a G 75.3060 The sound level 3 kilometers from
the fireho use is about 75 dB, well
above the level of no rmal
con versal ion .

The Exponential Function


The 11::) func tio n ( lv tX 1 if you exec ute it fro m the display), is used to raise numbers
to powers . Usi ng 11::) permits you to rai se a posi ti ve real number to any real power-that is,
the power may be positi ve or negative, and it may be an integer, a fractio n, or a mixed
number. 11::) also permits you to ra ise any negative real number to the power of any
integer (within the calcul ating range of the calc ulato r, of course).
98 Functions

For exa mple, to calculate 3 7 (that is 3 x 3 x 3 x 3 x 3 x 3 x 3):

Keystrokes Display
3 IENTER I 7 7_
0 2, 187.0000

Or to calcul ate 19- .o473

Keyst rokes Display


19 IENTER I 19.0000
.0473ICHSI -.0473 _
0 0.8700

And to calcul ate (- 16. 13)3 :

Keystrokes Display
16. 13 1CHS1 1ENTER I -16.1300
3 3_
0 - 4, 196.6534

In conjunction with ~ , 0 provides a simple way to extract roots. For example , fi nd


the cube root of 7: (This is equi valen! to 7 113 .)

Keystrokes Display
7 ( ENTERtl 7.0000
3~ 0.3333 Rec iproca) of 3.
0 1.9129 Cube root of 7.

Example: In her s tudy of fish ladders, Jeanneau


Colly must dete rmine the rate of water tlow down a
short spillway on the upper Umpqua River. l f the
average rate is too great , the salmon run up the
Umpqua will be di sturbed. Colly finds that the
following equation g ives the approxi mate rate of
water flow down th at spillway:

V = [(1.49/0.015) 1.9467 ] (si n 38) 1' 2


Functions 99

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 . ..

... from this ... ... tothis .


T R ,, 0.0000 T R ,, '2.x
z z R ,2 0.0000 z z R ,2 '2. X 2
y y R ,3 0.0000 y y R ,3 '2. Y
X X R ,4 0.0000 X n R ,. '2. y ,
R ,5 0.0000 R ,5 '2. X y
LAST X 0.0000 R ,6 0.0000 LAST X X R ,6 n

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 ~ .

Example: Below is a chart of monthly maximum


and minimum winter (October-March) rainfall for a
79-year period in Corvallis , Oregon. What are the
average maximum and minimum rainfalls and the
standard deviation of the maximum and minimum
rainfalls? Rainfall amounts are given in inches.

October November December January February March


Maxmum 9.70 18.28 14.47 15. 51 15.23 11 .70

Mnimum 0. 10 0.22 2 .33 1.99 0 .12 0.43

Keystrokes Display
lcu::I 0.0000 Clears the statistical registers (still
defined as R 11 through R 16 ) .

OIENTPI 0.0000 Clears the X- and Y-registers.


9.7 1ENTER I 9.7000
. 10~ 1.0000 First entry. Number of data pairs is
now l .
18.28 IENTERI 18.2800
.22[B 2.0000 Second entry. Number of data pairs
is now 2.
14.47 IENTERI 14.4700
2 .33 (B 3.0000
15.51 IENTERI 15.5100
1.99 (B 4.0000
15.23 IENTERI 15.2300
.12 (B 5.0000
11 .70 IENTER I 11.7000
.43~ 6.0000 Number of pairs is now 6 (n = 6).
Functions 103

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

... from this ... ... to this .

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

Deleting and Correcting Data


lf you key in an incorrect va lue and ha ve not executed ~, press 1CLx1 or E3 to delete
the incorrect number or d ig its, and key in the correct numbe r.
lf one of the values is changed, or if you discover that one of the values is in error after
you have executed the ~ function, you can corree! the summations by using the
~ (summation minus) functi on as follows:

l. Key in the incorrect dat a pair into the X- and Y-registers.


2 . Press ~ to delete the incorrect data.
3. Key in the corree! values for x and y . (lf one value of an x, y data pair is incorrect ,
both values mu st be deleted and reente red.)
4 . Press ~ -
The corrected value s for mean and standard deviation are now obtainable by executing
the !MEAN ! and 1soev1 func tion s .
104 Functions

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).

Operational and General Functions


Audible Tone Functions
The HP-41C is equipped with two functions that allow you to produce audible tones:
1BEEPJ and 1TONE1 .

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.

Exchanging X and Any Register


Earl ier in thi s handbook you leamed how 1 x~Y 1 exchange s the content s of the X-register
with the contents of the Y-reg ister. Us ing 1X<>1 you can e xc hange the contenls of X with
the content s o f any s to rage reg ister, including the rest o f the srac k (T, Z, and Y) , and
LAST X .
To exchange X with ano the r stac k reg ister o r LAST X . exec ute lx 0 1, press GJ (decimal
po int ) 10 spec ify the d e~ ired reg ister (T, Z, Y . X. o r L for LAST X ) .
To e xc hange X with any numbered reg isrer from 00 th rough 99 , ~ impl y exec ute 1X<>1 and
supply the two -di git reg i ~ te r address .

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

One value you needed in order to calculate the heat


loss from the water heater was the surface a rea o f the
cylinder. Let' s beg in the next problem by calcul at-
ing just the surface area of the top of the cylinder,
which , of course, is a ci rcle. The formula for the
area of-a ci rcle is A= 7Tr2 .

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 .

The Beginning of a Program


The beginning of each program you write should be " na med " or labe led with a string of
ALPHA characters, or a two-dig it number. These program labels enable you to keep track
of, and easily use, the programs you write. In a few moments you will leam how to use
l LBL 1 (!abe!) to labe l your programs. Fi rst, there are a few things that you should know
about labe ls.

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:

Proper ALPHA Proper Numeric


TRIG01 00
GO 83
A (Used as a local labe l.) 06

lmproper ALPHA lmproper Numeric


AUN. (!Ilegal period in na me.) 1 (Too fe w digits .)
COMP UTER (Too many 382 (Too many digits .)
cha racters.)

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.

The Complete Program


The complete program to sol ve fo r the area of a circle (one end of our cylindrical water
heater) given its rad ius is now:

, 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 .

1CLP1 (clear program) 1s1ze1 (number of storage registers)


E3 (correction) IPRGMl (program mode key)
1esr 1 (back step) IGrol(!:) (go to line number)
1ssr1 (single step) ~ (catalog list)
loELI (delete program lines) ~ (continuous power)
IASNl (assign) ~ (power on key)
luseRI (USER mode key) 1COPY1 ( copy or download program)
IGro l(!:)(!:) (go to end of program memory)

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.)

To load the complete program into the calculator:

1. Press IPRGM l to place the HP-41C into program mode.


2 . Pres s . IGTo l(!:)(!:) to set the HP-41C toan unused portion ofprogram 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:

, LBL l I ALPHA l CIRCLE 1ALPHA l

~
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.

. 55 .55 _ The second radius in meters .


lxEal XEQ __ The prompt.
1ALPHA 1 CIRCLE 1 ALPHA 1 0.9503 The answer in square meters.

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.

What Are lnstructions and Lines?


The HP-41 C has been designed so that you need not worry about program memory
structure-all you need to do is key in your program instructions -the HP-41 C takes care
of the memory, au tomatically. If you find that you need to know the rel ationship between
instructions a nd program memory, appendix O lisis ali HP-41 C instructions and the byte
requirements of each, as well as a brief explanation of how program memory is structured.
An instruction or line in a program is a series of keystrokes that make up one complete
operation in a program. Each complete instructi on is given a line number. Line numbers are
what appear in the display when you load a program . Depending on the kind of instructions
keyed in , you can store up to seven instruc tion s in each program memory register. But
agai n, you need not be concemed with the deta ils of progra m memory because the HP-41C
takes care of them for you.
Instrction s consist of a single function and ali of
the inputs necessary to co mplete the operation .
Complete numbers in a programare treated as single
instructi ons and take up only one line (e.g., 124. 75
is one line). Examples of instructions are 1cosl ,
lI!Il 6 and 1TONE1 3. 1cos1 alone is a complete
instruction because it perforrns a single operation
and <loes not require additional input or data. But
lI!IJ and 1TONE1 alone are not complete instruc-
tions. Since lI!Il and 1TONE1 both require number
inputs to complete the operation, their instructions
are not complete until the number is included .
lI!IJ 4 and 1TONE1 8 are examples of complete
operations.
Simple Programming 117

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.

The HP-41 C/41 CV and lnitial Configuration


The HP-41 C comes standard with 63 registers; the HP-41 CV comes standard with
319 registers. Initially, the calculators allocate 46 registers to program memory. The
remaining 17 registers in the HP-41C or 273 registers in the HP-41CV are allocated
to data storage. In this handbook, ali references to memory allocation assume your
ca/cu/ator's initial memory configuration unless otherwise specified.
Changing Memory Allocations
If at any time you fill program memory and attempt to load more instructions, the
calculator will pack program memory and display TRY AGA/N. When program
memory is full, each time you attempt to load an instruction the calculator packs
program memory and again displays TRY AGA/N. By executing ISIZE I (size o/ data
registers al/ocation) you can change the number of registers that are allocated to
program memory and data storage to make room for more program instructions (or
to change the number of data storage registers).
When you execute 1SIZE I, the calculator prompts you for a three-digit number from
000 through 319. ISIZE I specifies the total number of registers allocated to data
storage only. When you change the data storage register allocation, the number of
registers in program memory is automatically changed. lf you increase the storage
register allocation, the number of registers in program memory decreases; if you
decrease the number of data storage registers, the number of registers in program
memory automatically increases.
Note that if you execute 1SIZE 1and attempt to decrease the number of registers in
program memory when those registers contain program instructions, the calculator
will pack program memory and display TRY AGAIN. Before you can change program
memory into data storage registers, you must clear enough program instructions out
of program memory to make room for the reallocation. This prevents you from
accidentally losing program instructions when you execute 1SIZE l. For example, if
you add four registers to data storage, you automatically decrease the number of
registers allocated to program memory by four. Note that data storage registers are
numbered 000-318. So 1SIZE 1021 allocates Roo through R2o to data storage registers.

lnitial Allocation New Allocation


Data Storage Registers in Data Storage Registers in
Registers Program Memory Registers Program Memory
HP-41C 17 46 21 42
(Roo- R1s) (Roo-R20)
HP-41CV 273 46 21 298
(Roo-R272) (Roo-R20)
118 Simple Programming

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.

The 1END1 Function


As you read earlier, when you enter more than one program into program memory,
you should separa te those programs using an 1END 1 instruction. 1END 1 tells the
calculator that the end of a program 's space in program memory has been reached
and ali subsequent lines belong to another program. For example, program memory
now looks like this:
00
01 LBL 7HEAT
0230 This program was entered in the
03* introduction of this handbook.
04.47
05*
06END
00
O1 LBL 7CIRCLE
02X l2
03PI
04.
05END The end of the program and its
space in program memory.
Simple Programming 119

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.

Flowcharting Vour Programs


At this point, we digress for a moment from our di scuss ion of the calculator itself to
familiarize ourselves with a fundamental programming tool - the flowchart.

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

I LBL)I ALPHA )CIRCLE I ALPHA)

~
~

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.

(Answers: 11 .5624 inches, 0.6180 meter, 0.5381 meter.)


2. Write and load a program that will convert temperature in degrees Celsius to degrees
Fahrenheit , according to the formula F=( l. 8XC)+32. Name the program CTEMP
and termnate it with loml. Convert Celsius temperatures of -40, O, and 18.
(Answers: - 40.0000 F, 32 .0000 F, 64.4000 F.)
Section 8

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.

Now let's write and load a program that dete rmines


the total surface area of the cylinder given its height
(h ) and radius (r). The formula used is S= (2m2 ) +
(27rrh). Below are the instruc tio ns for the program ,
assuming that the radius and the he ight have been
placed into the X- and Y-regi sters of the stack,
respectively. The name of the prog ram is AREA.

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

Running the Program


To run AREA you only ha ve to execute it using 1XEO1 or assign it to the keyboard for
single-key execution. For ease of use, le t's assign it to the i LOG 1 key location and then
execute it in USER mode. When you assign a program (that you have stored into program
memory) to a key location, the calculator remembers the assignment by storing it with the
LBL of the program.
Keystrokes Display
. I ASN J ASN _
1 ALPHA 1 AREA 1 ALPHA 1 ASN AREA _
ILOGI 11.0000 AREA is now assigned to the i LOG )
key location for USER mode
execution .
11.0000 Places the HP-41C into USER mode
so you can use the reassigned key.
i AREA J (l LOG J ) 4,216.0173 The area of the cylinder in square
inches.

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.

Resetting to the Beginning of a Program


To begin editing a program, you may need to set the calc ulator to the beginning of that
program. There are severa! ways to do this, depending on the status of the calculator and
your personal preference .
To reset to the beginning of the program:

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 ).

To reset to the beginning of AREA:

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.

Single-Une Execution of a Program


In normal or USER mode, you can execute any program you have stored in program
memory one line at a time by pressing the 1ssr 1 (singl e srep) key.
To execute one line of AREA at a time usi ng a hei ght of 132 centimeters and a radius of
29.2 1 centimeters, you must first initialize the program:

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

To begin modifying your program, reset the calculator to line O of AREA.

Keystrokes Display
. IGTOl0 000 00 REG 40
132 Program Editing

Single-Une Viewing Without Execution


You can use 1SST1 (single step) and 1BST1 (back step ) in PRGM mode to si ngle-step to the
de sired fine of program memory without executing the program . Each press of 1SST1 steps
forward one fine in the prog ra m, and each press of 1BST1 steps back one fine in the program .
Both 1SST1 and 1BST1 operate only within the curren! program. Pressing 1SST1 when the
calculator is set to the e nd of a program positions the calculator back to the beginning of
that program . In a si milar way, pressing 1BST1 when the calculator is set to the top of a pro-
gram positions the calculator around to the e nd o f that program .

.----- 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

00 --- - - - - - Pressing 1BST1 when the calculator


01 LBLT AREA is positioned at the top of the pro-
gram moves the calculator to the end
[ of this program .
16 END

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 ...

... from this ... . .. to this.


00 00
01 LBLTAREA 01 LBLTAREA
02 STO 01 02 STO 01
03 X T2 03 XT2
04 PI 04 PI
05 * 05 *
06 2 06 2
07 * 07 *
08 X <>Y 08 PSE --- - - - - - The 1PSE J instruction was inserted
09 RCL 01 ~09X<>Y here.
10 * ------- 10 RCL 01
11 PI *
..... 11 Ali subsequent instructions are
12 * 12 PI " bumped" down in program
13 2 13 * memory.
14 * 14 2
15 + ~ 15 *
16 END ------: 16 +
17 END
134 Program Editing

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.

Going to a Line Number


It is easy to see that if you wanted to single-step from line 000 to sorne remote line number
in program memory, it would take a great deal of time anda number of presses o'f the 1SST 1
key. So using the IGTOl0 nnn function, you can set the calculator to any line in the
program. < laTOl0 nnn cannot be recorded as a line in a program.)

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

... from this ... ...to this.


00 00
01 LBLTAREA 01 LBLTAREA
02 STO 01 02 STO 01
03 Xt2 03 Xt2
04 PI 04 PI
05 * 05 *
06 2 06 2
07 * 07 *
08 PSE 08 PSE
09 X <>Y 09 X <>Y The 1PSE J instructi~n was inserted
10 RCL 01 10 RCL 01 here.
11 * 11 *
12 PI 12 PI
13 * 13 *
14 2 14 2
15 * 15 *
16 + 16 PSE
- - - . 17 +
17 END
- - - - . .18END } Ali subsequent instructions are
moved down in program memory.

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.

. ,GTOIG]IEEX] 540 = go to line 1540

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.

Running the Modified Program


To run the modified AREA program, you have o nl y to take the calculator out of PRGM
mode and, since the calculator is still in USER mode, simply press thel LOG 1 key (remember
that you assigned AREA to the 1LOG] key Jocation for execution in USER mode).
Run the modified AREA program for values of 78" (height) and 14" (radius):
136 Program Ediling

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.)

Deleting and Correcting lnstructions


Deleting lnstructions
Often in the modification of a program, you may wish to delete an instruct ion from program
memory. To delete the instruction to which the calculator is set, s imply press the nonrecord-
able function EJ (correction ) with the calculator set to PRGM mode. (Refer to pages
42-43 to see how B works in normal mode.)
When you delete an instruction from program memory using EJ, the calculator moves
to the line befare the de leted line and dis plays it.

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.

08 X <>Y The lx ~ YI was in 9 but was moved


up to 8 when you dele ted the 1PSE1 .
Program Editing 137

When you set the HP-41C to fine 8 and pressed 8 to defete the (PSEI, the program was
altered ...

... from this .. ... to this.


00 - ---1. . 00
01 LBLTAREA - ---1. . 01 LBLTAREA
02 STO 01 02 STO 01
03 X f 2 03 Xf2
04 PI 04 PI
05 * 05*
_ ___,.. 06 2
/ One fPSEI defeted here.
06 2
07 * - ---.- 07*
08 PSE ______., 08X <>Y
09 X <>Y ______.,09RCL01
10 RCL 01 10 *
11 * : : : : = = 11 PI
12 PI ______., 12* These instructi ons ali move up.
13 * ______., 132
14 2 _______., 14 *
15 * _______., 15 PSE
16 PSE .,.... 16 +
17 + ~ 17END
18 END

Now , to de fete the 1PSE1 instruction that is at fine f 5:

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 Dis play


IPRGMI 00 REG 38 Sets the HP-4IC to PRGM mode.
. (GTOJ 8 01 4 14 *
lxEOI 15 XEQ __
1 ALPHA l PSF 15 XEQ PSF _ Whoops, thi s should be PSE, not
PSF. Whe n you make an error,
simply press E3 .
El 15 XEQ PS _ Now you can key in the correct
letter, E.
E 15 XEQ PSE _
i ALPHA l 15 PSE The (Pse l is now in line 15.
IPRGM J 1,483.8370 Result remains from example on
pagc 137.

Run the program usi ng a he ight of 56 inches and a radi us of 12 inches.

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

Using lcATALOGI for Positioning


~ 1 lists ali of the programs that you have recorded in program memory . In addition,
asan aid to positioning the calculator to programs in program memory, as the listing of cata-
log 1 progresses, the calculator is set to the location in program memory of each program
name as it is displayed. When the next program name is displayed, the calculator is posi-
tioned to that program in program memory.
~ 1 lists o nly ALP HA progra m labels a nd END instructions.
For example, if the CIRCLE and AREA programs you ha ve placed in program memory are
intact, program memory looks like this ...
01 LBL TC/RCLE
02 Xf 2
03 PI
04 *
05END
01 LBLTAREA
02 STO 01
03 Xf 2
04 PI
05 *
06 2
07 *
08 X<> Y
09 RCL 01
10 *
11 PI
12 *
13 2
14 *
15 PSE
16 +
17END
... when you execute (CATALOGI 1 , you will see the following:

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.

The [ PACK 1 Function


For your convenience during ed iting sessions, the HP-41 C inserts extra bla nk lines in your
programs. These blank lines are invisible to you; you cannot see them in program memo ry.
They are placed in your programs to assu re that while you are inse rting and deleting instruc-
tions, the calculato r responds to your commands as quick ly as poss ible.
There are several ways that the HP-4 1C automaticall y removes these extra lines when you
are through editing . This is call ed " pac king." Following is a summary ofthe times that the
HP-4 1C automaticall y packs prog ram me mory.

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

b. Run the program to com pute the time


taken by a stone falling from the top of
the Eiffel Tower, 300.51 meters high;
from a blimp stationed 1050 meters in
the air.
(Answers: 7.83 13 seconds; 14 .6385
seconds.)

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

(This page intentionally left blank.)


Section 9

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.

Using 1sroP1 and 1 R/s]

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:

1. lf a program is running , a 1STOP1 is executed and progra m execution is halted . The


only keys that can halt a running prog ra m (fro m the keyboa rd) are the @:E] a nd 1R/ S1
keys.
2 . If a progra m is stopped or no t running , 1R/ S1 starts the progra m running beg inning
with the c urren! line in the program.

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

Now assign SPHERE to the@ key location .

Keystrokes Display
. IASNI ASN _
1ALPHA 1 SPHERE 1ALPHA1 ASN SPHERE _
@ 0.0000

Run lsPHEREI to find the volume of a spherical


weather balloon with a radius of 2 1.22 feet. Run
lsPHEREI again to find the volume of an official size
ping pong ball with a radius of 1.905 centimeters.
Program lnterruptions 147

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.

IRtsl 40,024.3924 The answer in cubic feet.

lsPHEREI (@J) 0.0000

1.905 1.905 - The radius of the ping pong ball in


centimeters.
@!) 28.9583 The volume ofthe ping pong ball in
cubic centimeters.
luseR l. lcLxl 0.0000

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.

Using 1PSE1 (Pause)


The 1PSE1 (pause) instruction executed in a program moment ari ly interrupts program
execution and displays the contents ofthe X-register. The length ofthe pause is slightly less
than one second, although more 1PSE 1 instructions in subsequent lines of a program can be
used to lengthen viewing time, if desired .
Each time a pause is executed, the PRGM annunciator blinks one time . This lets you know
that the program is running- even during a pause.
During program execution, the only keys that are active are IRt s l and ~. However,
during the execution of a pause, or a string of pauses, the entire keyboard becomes active.
You can actu ally input data to your program during a pause.
Pressing data entry keys during the execution of a pause causes the pause instruction to be
executed again (or until you have completed the data entry). Data entry keys are: 1ALPHA1 ,
1USER1, ' 8 ' o through 9' 1CHS1 ' 1EEX1 ' and ali ALPHA c haracters.
Pressing any other keys during a pause, that is, any keys not associated with data entry,
causes the pause to termnate and program execution halts. The pressed function is
executed .

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

Prompt & stop


to key in radius

Calculate A = 7Tr2

Pause to display A

Prompt & stop


to key in height

Calculate V= A x h

Pause to display V

Prompt & stop to


key in number of cans

Calculate Total Volume =


Vx n
Section 10

Programming with ALPHA Strings

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.

Using ALPHA Strings in Your Programs


You can use ALPHA strings in many different ways in your programs, and there are
certain ways that these strings change what you see in the display while a program is
running.
For example, you can place an ALPHA string in a program and instruct the program to
display that string with 1 AVIEW l. The ALPHA string that you input as a line in the program
is placed into the ALPHA register. 1 AVIEW 1 then places the contents of the ALPHA register
into the display. As program execution progresses, the display continues to display the
string until the program clears the string from the display, or you place a new string into the
display.
Any time a program places an ALPHA string into the display , that string replaces the ~
program execution symbol. When the program clears the display or the program is
interrupted, the ~- retums to the display. Regardless of what is displayed, the PRGM
annunciator is always displayed during a running program.

However, using IAPPENDI <


The maximum length of an ALPHA string on any one line in a program is 15 characters.
K in ALPHA mode), you can construct strings of up to 24
characters. Key in the first 15 characters in the string, press IAPPENDI and then key in the
remainder of the characters. The first 15 characters will be on one Iine in the program, and
the remainder of the characters will be on the following line. Refer to section 3 in part 1 for
more information about IAPPENDI .

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

Find the log of 8 to see how the program works:

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

1. Key in the ALPHA string as a line in the program .


2. Recall the result to be labeled into the display with 1Nn1 . Since 1Nn1 adds to what-
ever is already in the ALPHA register, you may wish to clear the ALPHA register
before you use 1NO. 1 .
3. Then use 1Av1Ew 1 in the program to place contents of the ALPHA register into the
display.

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 .

Prompting for ALPHA Strings


You can prompt for the input of ALPHA information just like you would for
numbers. Using the IAONl(ALPHA on) a nd IAOFFl(ALPHA off) functions, you can
even control the mode the calculator is set to when the program stops for input.
1AON 1places the HP-41 Cinto ALPHA mode and 1AOFF 1takes the calculator out of
ALPHA mode.

Clearing the Display and ALPHA Register


To clear the contents of the display at any time during a running program, simply key
in 1CLD 1(c/ear display) as a line in the program. This clears the display and then
displays the X-register, or the ALPHA register (if the calculator is in ALPHA mode).
To clear the contents of the ALPHA register at any time during a running program,
place the calculator in ALPHA mode, key in 1 CLAI (c/ear ALPHA) as a line in the
program, then remove the calculator from ALPHA mode.

Using ( ASHF J (ALPHA Shift)


1ASHF1 is a handy HP-41 e function that shifts the contents of the ALPHA register to the left
by six characters. Manually orina program, when you wish to store a long ALPHA string
into severa! storage registe rs, 1ASHF1 makes the task simple. (Remember, each data storage
register can hold up to six ALPHA characters .) When 1ASHF1 is executed, the left-most
six characters in the ALPHA register are sh ifted off to the left and are lost. The
remaining characters in the ALPHA register ali shift to the left by six positions.
Programming with ALPHA Strings 155

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

Now load the progra m.

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.)

01 LBLT BILL 1 Program name.


02 STOP Stops for input of quantity .
03 STOP Stops for input of unit price.
04 * Computes total price.
05 STOP Stops for input of tax rate.
06 % Computes tax amount.
07 + Computes fi nal amount.
08 END
157

O 1 L IJL -, /3 i I 1 I

(This page intentionally lelt blank.)


Section 11

Branching and Looping

Branching and Looping


Earlier in this handbook you leamed how you can use IGTol GJ anda program line number
or ALPHA label to position the calculator to a particular place in program memory . In addi-
tion , you saw how IGTolG]G] positioned the calculator to the end of program memory to
prepare the calculator for a new program. You can al so use 1GTOI (go to la bel) in your pro-
grams followed by an ALPHA or numeric label to transfer execution to any part of a
program you desire .

A IGTol instructio n used in thi s way is known as an unconditiona/ branch. It always


branches execution to the specified label. (Later, you will see how a conditional instruction
can be used in conjunction with a IGTOI to create a conditional branch-a branch that
depends on the outcome of a test.)

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

A common use of a branch is 10 creare a ' loop'' in a


program . For example, the following program cal-
culates and displays 1he square roots of consecuti ve
whole numbers begi nning wi1h the number 1. The
calculator continues to compute 1he square root of
lhe next consec uti ve whole number until you press
1R/S1 to slop program executi on (or until the
HP-4 1C overflows).

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.

Now, run the program:

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

iiiii is the c urren! counter value,


fff is the counter test value , and
ce is the inc rement value.

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).

lncrement and Skip if Greater


Each time ~ is exec uted , it first increments iiiii by ce . It then tests to see if iiiii is greater
than fff . If it is, then the HP-41 C skips the next fine in the program.
So, if you stored the number 100.20001 in storage registe r R 10 , the ~ 10 instruc tion
would begi n counting at 100 , would count up until the counter was greater than 200, and it
wou ld incre ment by 1 each time the loop was executed.

Con tents o f storage register R 10 = 100.2000 1


Executi on of [ ISG 1 1O would:
Start countin g at 100.
lncrement by 1.
Test to see if counter is greater than 200.
After one execution or pass through the loop , R 10 would be 101 .20001 . After 10 executions
or passes thro ugh the loop , R 10 would be 110.20001 . Each time~ 10 is executed it
checks to see if the counter is greater than 200 . When it is greater than 200, it skips the next
line of the program. You will see how skipping the next line in_the program is usefu1 in a
moment.
If you execute l 1sG 1 from the keyboard, it simply increments the specified register just like
it would in a program, but no program lines are executed or skipped .

Decrement and Skip lf Equal


Each ti me 1osE 1is executed , it first decrements iiiii by ce . It then tests to see ifiiiii is equal to
(or less than) fff . If it is, then the HP-4 1C skips the next line in progra m memory.
So, ifyou stored the number 100.01001 in storage registe r R 11 , the losE 1instruction would
begin counting down at 100, would count down until the counter was equ al to (or Iess than)
10, and it would decrement by 1 each time the loop was executed .

Contents of storage reg ister R 11 = 100.0 100 1


Exec ution of 1OSE 1 1 1 wou ld:
Start at 100.
Decrement by 1.
Test to see if counter was equal to (or less than) JO.

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.

~ 08 Xt2 Squares the number.


lxeal
1ALPHA 1 PSE 1ALPHA 1 09PSE Displays the square of the number.
- ~01 10 ISG 01 Increments R 01 by 2 and checks to see
that the counter is not greater than
the final number (50) . If the counter
is not greater than the final number,
executes the next line . If the counter
is greater than the final number,
skips the next line in the program.
!Gro! 01 11 GTO 01 Loops back tol Le L 1 01.
. IGTOJ88 00 REG 42
166 Branching and Looping

Now run the program:


Keystrokes Display
IPRGM I 0.0000 Takes the HP-41 C o ut of PRGM
mode.
lxeo l
1 ALPHA 1 EVENS 1 ALPHA 1 2.0000 When the HP-4 1C begins executing
4.0000 the program , it fi rst pauses to di s-
play the number then pauses to
4.0000 di splay its square. Whe n the loop
16.0000 counter increments beyond 50, the
progra m stops.

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.

Keyst rokes Display


IPRGM I
. ,GTOl88 00 REG 46
. ILBL)
1 ALPHA l GOTHAM 1 ALPHA l 01 LBLTGOTHAM The program name .
1 ALPHA l YEARS? 1 ALPHA 1 02TYEARS? The ALPHA prompt.
lxeol
1 ALPHA 1 PROMPT 1 ALPHA 1 03 PROMPT Displays prompt and stops for input.
l sro l 00 04 STO 00
1624 05 1624_
lsrol 01 06 STO 01
24 07 24 _
lsro l 02 08 STO 02
. I LBLl 01 09 LBL 01 The beginning of the loop.
IRCLl 02 10 RCL 02
6 11 6 _
oo 12 %
lsrolffi 02 13 ST + 02
Branching and Looping 167

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

Store loop control


number in R05

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

Conditionals and Conditional Branches


Often there are times when you want a program to make a decision. For example, suppose
an accountant wishes to wri te a program that will calculate a nd display the amount of tax
to be paid by a number of persons. For those with incomes of $ 10,000 per ye ar or under, the
amount of tax is 17 .5% . For those with incomes of over $10,000, the tax is 22% . A
flowchart fo r the program might look like thi s:

Prompt for
income amount

Stop to key in
income amount

Yes No

Compute Compute
22% of income 17.5% of income

Display tax

T he conditional operations on you r HP-4 1C are useful as program instructions to allow


your calculator to make deci sions like the ones shown above. The te n conditionals avai lable
in the HP-41 C are shown below.

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

YES .. Conditional Test

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

To run TAX to compute taxes on incomes of $38,000 and $7,600:


Keystrokes Display
IPAGMI 0.0000 Takes the HP-4J C o ut of PRGM
mode.
lxeo l
1 ALPHA 1 TAX 1 ALPHA 1 INCOME? The prompt for the income .
38000 38,000 _

I R/ S I 8,360.0000 The tax at 22%.


lxeol
1 ALPHA 1 TAX 1 ALPHA 1 INCOME?
7600 7,600 _
IR IS 1 1,330.0000 The tax at 17.5%.
. jCLxl 0.0000

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

Add 360 degrees


174 Branching and Looping

2. Write a program th at will calculate the gas and


ol cost fo r Linda Leadfoot 's planned vaca-
tion. The car gets about 33 miles per gallon
but use s a quan of oil every 350 miles. Use a
cond itional test to see if the mileage is greater
than 350 mile s. The following flowchan will
help you write the program.
Run the prog ra m to find the oil and gas cost
for Linda's proposed trip to Seattl e,
Washington. The round-trip is 494 miles. O il
is $0. 75 pe r quart and gas is $0.69 per gall on .
( An swer: Oi l cos t is $ 1.06 a nd gas is
$ 10.33 .)

Prompt for & input Multiply by Ro2


total mileage
Pause to display oil cost
Store in R0 , (Label output if you wish)

Place 350 in Y-register LBL 01

Prompt for &


Yes input gas cost

IGo to LBL 01 I Store in R03

Recall mileage &


Prompt for &
input oil cost divide by 33

Multiply by Ro3
Store in R02

Label output
Recall mileage & and display cost
divide by 350
175

(This page intentinally left blank.)


Secton 12
Subroutines

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 .

Subroutine Types and Label Searching


Basically, there are two types of subroutines that you can use in your programs. Subrou-
tines are either inside the program file or outside the program file . Each of these types of
subroutines must be terminated properly. Here are sorne detai ls.

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

Subroutines lnside The


Program File
LBLTTEST LBLTTEST

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

Subroutines Outside The


Program File
LBLTTEST This subroutine LBLTTEST
/ LBL~ABC) has an ALPHA LBLTABC These sub-
XEQTABC : label and is XEQTABC / : routines have
: ...,,....,.,_____ END terminated ..,...__ _ _ RTN ALPHA labels
with IEND 1. XEQTDEF ~ LBLTDEF
grouped to-
END
gether, only
E~:------E~D the final one
must be term i-
nated with
IENDI .

Example: A quadratic equatio n is of the form


ax2 + bx+ c = O. One way to find its two roots is by
using the formu las:

Notice the similarity between the solutions for r 1


and r2 . The program below prompts you for the
values of a , b , and e, stores those values in storage
regi sters Roi. R02 , and R03 , and sol ves for the real
roots r 1 and r2 .*

'Sorne values of a. b, ande may result in misleading answers because their solutions require greater than 12 digits
of accuracy.
180 Subroutines

Here is a complete prog ram for calculating the two


roots of a quadrati c equation:

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

The program with a subroutine would look like this:

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.

Details of Subroutine Usage


Subroutines give you superb versatility in prograrnrning. A subroutine can contain a loop,
or it can be executed as part of a loop. Subroutines can even be complete programs with
their own ALPHA labels; separate from the program that executes it.
184 Subroutines

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

Begin by loading the master program, BTU.

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

Now load the TEMP program .

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

Finall y , load the AREA prog ram.

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

Six returns can be pending.


Flrst Subroutlnes
Program

;( 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

When you press ~ in USER mode, the HP-41C first


searches for LBL A within the current program.

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.

Now run the program to solve the follow ing problem:

On May 26, 1969 the Command and Service Mod-


ule of Apollo X carried U .S. astronauts Stafford,
Cernan, and Young at a rate of 24,791 miles per
hour (the fastest speed at which any human has
traveled) . How far would the module travel in 2.5
hours?

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

Now run the program. Make su re the calculator is in USER mode.

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.

T = D-:- R = 300 + 2.25


192 Subroutines

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?

2. The-surface area of a sphere can be calculated according to the equation A = 47Tr 2 ,


where r is the radius. The formula for finding the vo lume of a sphere is V =(47Tr3)+ 3.
This may also be expressed as V = (r X A )+ 3.

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

3. Daredevil test pilot Trigo Skywalker is divi ng


in a wingless R2DART experimental aircraft
at an angle of 45 degrees anda veloci ty of745
meters/second. Suddenly, at an altitude of
7460 met ers, th e R2 loses power a nd
Skywalker parac hutes to safety. How long
after the R2 loses power does it fl y before
crashing? (Effects of at mospheric drag and
variat ion in the grav itational acceleration are
ignored .)

Solution: The equation describing the fall of the plane is:

y = -(g + 2)t 2 - vt + y

where y is the altitude. (In our problem y= O when the plane crashes.)

g is the acceleration of gravity, 9. 80665 m/s 2

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.

y; is the initial altitude.

t is the time in flight after power failure (seconds).

(Answer: 12.6675 seconds.)

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

Prompt for &


input flight angle

Find sine of angle

Prompt for & input


velocity of plane

Multiply velocity
by sine of flight angle;
change sign & store into R02

Prompt for & input


altitude of plane

Store altitude into R03

Execute QROOT

8
195

(This page intentionally left blank.)


Section 13

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

IFs?I nn " Flag set" test.


IFC?i . nn " Flag clear" test.
1 FS?Cj . nn " Flag set" test and clear.
IFC?cl nn " Flag clear" test and clear.
lxoj. nn Exchange X and any register.
[CArAl.OGI nn Catalog list.

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.

lndirect Store and Recall


To store and recall numbers indirectly using any of the primary or extended storage regis-
ters, simply press 1sro1 or 1RCL1 , , and then specify the indirect address. By changing
the register address number, you can change the address specified by the function.
You can easily demonstrate how indirect store and recall work by using the HP-4JC
manually. For example, to store the number 2.54 into R 10 using R02 asan indirect address
register:

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

i The lndirect Address Register


R 02 10.0000

i The Desired Register


R,0 2.5400

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

+ The lndirect Address Register


R 05 10.0000

The Desired Register


(Recalled into the X-register.)
2.5400
200 lndirect Operat1ons

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.

lndirect ALPHA Store and Recall


The IAsrol (ALPHA store ) and IAACLI (ALPHA r ecal/) functi ons can also be used with
indirect addressi ng, jusi like with normal lsTo l and IRcLI. (Remember that IAsTol is the
!>hifted function on the 1STO1key in ALPHA mode , and 1AACL1 is the shifted function on the
IRcLI key in ALPHA mode.) Simply store the desi red register address numbe r into the
indirec t address reg ister you choose. The n exec ute the functio n , specifying and the
indirec t register address in response to the prompt.
For example, store the string WATER into R0 8 using R 00 as the indirect address register.

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

lndirect Stack and LAST X


Re member from section 5 that you can specify the stack and LAST X as register addresses
by si mply pressing 8 (decimal point) and X, Y, Z, T, or L (for LAST X) . You c an al so use
the stack and LAST X registers as indi rect addresses by simply pressing 8 and X , Y,
Z, T , or L following the function . For example, to store the number 83. 9701 in to R 1 1 usi ng
stack Z as the indirect address register:

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.

lndirect Function Control


Now that you have seen how indirect addressing works, Iet's progress a little and see how
sorne of the other indirect features wo rk in prog ra ms.
Functions requiring the input of an operating specification like 1TONE1 and ~ can use
indirect addressing to specify how the function is to operate . For example, ~ requires a
number from O through 9 to spec ify the di splay formal. Using indirect address ing, you can
store the format specificatio n number in a register, and then use indirect addressing to com-
plete the function ( ~ nn) . lndirect control is most useful in programs you write .
202 lndirect Operations

Example: The following program uses two con-


trolled loops to place a numbe r used by the 1TONE1
(audible tone) functi on . The program counts from O
to 9 and control s the first loop using l 1sG 1, then
counts back to O a nd contro ls the second loop using
losEI .

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.

lndirect Control of Branches and Subroutines


Like indirect addressing of storage regi sters, you can address routines, s ubroutines, even
entire programs using indirect addressing.
To indirectly address a subroutine with an ALPHA or numeric label (e.g., ILBL I TRIGO,
1LBL 1 1O) , use the 1GTOI . nn ( go to indirect) instruction in the program. (The calculator
di splays the prompt /ND following the function name.) When the running program encoun-
ters the GTO IND nn instruction, the calculator searches the curre n! program for a numeric
label and ali of program memory for an ALPHA label that is specified by the indirec t address
register. (Jf the label is not found, o r if the label is not a legal label-e.g., the numeric
label is greater than 99, the display shows NONEXISTENT .) Local labels (A through J ,
a through e) cannot be used indirectly with IGTOI .
Asan example, with the ALPHA label SOL VE stored in register R 1 ~, when the GTOIND 15
instruction is encountered, execution is transferred to the last 1LBL1 SOL VE in memory. If
the label SOL VE is found, execution resumes there . A IGTOI to a numeric label will not
transferexecution o ut of a program file, but a IGTOI toan ALPHA label will transferexecu-
tion out of a program file (refer to section 12 for a complete discussion of label searching,
branches and transferring execution).
204 lndirect Operaltons

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:

nnnn. to nn.nn .nnnn to nn.nn


[EEXJ 2 [EEXJ 2
0 0
206 lndirect Operations

To change the result , .nnnn , back to the input form , nnnn . or nn .nn :

.nnnn to nnnn. .nnnn to nn.nn


leexl 4 leexl 2
0 0
Truncate the square to extract a new seed of the fonn .nnnn using:

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

(This page intentionally left blank.)


Section 14

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.

There are 30 user'' flags (numbered 00 th rough


29) avai lable in your HP-4 IC . In additio n, there are
26 .. system " flags (numbered 30 through 55) that
ha ve limited uses to you in your programs . On pages
21 O and 211 are :ables show ing HP-41 C flags and
their basic capabilities. The HP-41C has six func-
tions that allow you to manipulate the flags.

Three of the fl ag functions are o n the norma l mode keyboard. They are:

(gJ (set flag)


~ (c/ear fla g)
1FS? 1 ('flag set" test)

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:

IFC?J (''flag c/ear" test)


IFS?CJ (''flag set" test and c/ear)
IFC?CJ (''flagc/ear" testandclear)

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

HP-41C USER FLAGS (00 THROUGH 29)

Flag Name Flag Number Set Clear Test Status


General Purpose User 00 through 1O X X X Always maintained by
Flags (11) Continuous Memory.
Special Purpose User 11 through 20 X X X Cleared each time the
Flags (10) HP-4 1C is turned on.
Automatic Execution 11 X X X Cleared each time the
Flag (Special Purpose HP-41C is turned on.
Flag 11)
Printer Enable Flag 21 X X X Matches flag 55 status
each time HP-41 C is
turned on.
Numeric Input Fl ag 22 X X X Cleared each time the
HP-41 C is turned on.
ALPHA Input Flag 23 X X X Cleared each time the
HP-41 C is turned on.
Range Error Ignore Flag 24 X X X Cleared each time the
HP-41 C is turned on.
Error Ignore Flag 25 X X X Cleared each time the
HP-41 C is turned on.
Audio Enable Flag 26 X X X Set each time the
HP-41 C is turned on.
USER Mode Flag 27 X X X Always maintained by
Continuous Memory.
Decimal Point Flag 28 X X X Always maintained by
Continuous Memory.
Digit Grouping Flag 29 X X X Always maintained by
Continuous Memory.
Flags 211

HP-41C SYSTEM FLAGS (30 THROUGH 55)

Flag Name Flag Number Set Clear Test Status


Catalog Flag 30 X Not applicable.
Peripheral Flags (5) 31 through 35 X Not applicable.
Number of Digits 36 through 39 X Always maintained by
Flags (4) Continuous Memory.
Display Formal Flags !Iill 40 X Always maintained by
IENGI 41 X Continuous Memory.
@] (refer
to page 232)
Grads Mode Flag 42 X Always maintained by
Continuous Memory.
Radians Mode Flag 43 X Always maintained by
Continuous Memory.
Continuous On Flag 44 X Not applicable.
System Data Entry 45 X Not applicable.
Flag
Partial Key Sequence 46 X Not applicable.
Flag
Shift Set Flag 47 X Not applicable.
ALPHA Mode Flag 48 X Cleared each time the
HP-41 C is turned on.
Low Battery Flag 49 X Not applicable.
Message Flag 50 X Not applicable.
SST Flag 51 X Not applicable.
PRGM Mode Flag 52 X Cleared each time the
HP-41C is turned on.
1/0 Flag 53 X Not applicable.
Pause Flag 54 X Not applicable.
Printer Existence Flag 55 X Set if printer exists or
clear if no printer each
time the HP-41C is
turned on.
212 Flags

To begin leaming how to use the flags, set flag 00:

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?

lf YES (flag 0 1 is set), ' f----- FS? 01


lf NO (flag 01 is not set),
continue with the next .....
line. ~
J skip one line.

-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

1ALPHA 1 PSE 1 ALPHA 1


. (ITJ00
03TSET
04 AVIEW

05 PSE
) Display SET when flag 00 is set.

06 CF 00 Clear flag OO.


. ILBLI02 07 LBL 02
IFs?I 00 08 FS? 00 Test flag OO.
. (Grol 01 09 GTO 01
1ALPHA 1 CLEAR 10TCLEAR
1AVIEW 11 ALPHA 1 11 AVIEW lf the test is true , go to LBL Ol.
lxeal Otherwise, display CLEAR, set flag
1ALPHA 1 PSE 1ALPHA 1 12 PSE 00 a nd go to LBL 02.
C0 00 13 SF 00
. IGTOI 02 14 GTO 02
. IGTOIGJGJ 00 REG 41

Now run the program.

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 .

Display SET Display CLEAR

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

Display SET Display CLEAR

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.

General Purpose Flags (00 through 1O)


The HP-41C is equipped with 11 general purpose user flags (numbered 00 through 10).
You have complete control ofthese flags . They can be set, cleared, and tested using any of
the HP-4 1C flag control function s. Once you set or clear one or a li of these flags, that status
is mai ntained by the Continuous Me mory of the calc ulator, e ven when the HP-41 C is tumed
on and off.

Special Purpose User Flags (11 through 20)


There are 1O special purpose flags in your HP-41 C. In addition to their use as flags that you
can control , fl ags 11through20 have special functions in the HP-41C. You ca n test, set and
clear these flags using any of the fl ag commands di sc ussed earlier in this section. However,
unde r certain conditions, the calculator also contro ls the status of these flags .
When yo u are using peripheral e xtensions such as the printer or card reader , it is a good idea
to keep in mind that the statu s o f these flags may be altered by the calc ulator. Refer to the
owner's handbook that be longs to the peripheral ex te nsion for specific details about flags.
Ali of these 1O spec ial purpose use r flags ( 11 throu gh 20) are cleared each time the HP-41 C
is turned o n.

Automatic Execution Flag


Flag 11 is one of the special purpose flags described above. lts special purpose in the
HP-41 C is to control prog ram exec ution when the HP-4 1C is tumed on.
When flag 11 is set, and you turn the calculator off, the HP-41C automatically begins exe-
cuting the current program in program memory when you tum the HP-4JC back on again.
Execution begins at the instruction the calculator was positioned to before the HP-41C was
tumed off. In addition, the calculator sounds the audible tone before execution begins.
If flag 11 is clear and you tum the calc ul ator off, when you tum the HP-41 C back on again,
the calculator turns on normall y . Program instruct ions are not executed .
Remember that flag 11 is automatica lly cleared each time the calculator is tumed on.

Printer Enable Flag


This flag (fl?g 21) is used to enable and disable printing from programs on the HP 82143A
Printer. You can set, clear and test this flag just like any other of the general or special pur-
pose flags described above.
Flags 217

When flag 21 is clear, printing by programs is suppressed.


On the other hand , if flag 21 is set, printing by programs is enabled.
Flag 2 1 has no effect on print fun ctions executed from the keyboard. Execution of any
printer function while the printer is not plugged in results in the NONEXISTENT display.

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. )

Data Entry Flags


Therc are two flag!. in the HP-4 1C th at are u ~ed to detect keyboard data input : the numeric
input flag (22) and the ALPHA input flag (23).
Fl ag 22 is used to detect numeric data input. The HP-41 C automatically sets fl ag 22 when
nume ric data i!> entered from the keyboard.
Flag 23 is similar to flag 22 except that it is used to detect ALPH A data input. The calculator
set!> flag 23 when ALPHA data is e ntered from the keyboard.
Both fl ags 22 and 23 are cleared each time you turn the calculator on.

Exa mple: Comp uter programming student Jill Bit-


ter i!> a little confused abo ut how to use hexadecimal
numbers (base 16). Her teacher suggests th at s he
write a prog ram o n he r HP-4 1C to convert hexadec-
imal numbers to decimal numbers. Jill 's first prog-
ra m is below. lt converts a single-dig it hexadecima l
number to dec imal.
218 Flags

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

Store A-F into R10-R1s

Prompt for input

Yes
Clear flag 22

No

Yes
Store ALPHA into X-register

Clear flag 23

Store lliQJ loop control


number into R02 (10.01501)

Using loop control number


as a register address, recall
ALPHA that is stored in
indirectly addressed register

lncrement R02 by
No 1. Stop if > 15
(Use lliQJ 02)

Display integer portien of


loop control number. (Same as ,____ _ ___,.,
decimal equivalent of ALPHA
stored in that register)
220 Flags

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

22 17 FS?C 22 Was the input a number? ...


I RrNJ 18 RTN ... yes, displays number and stops.
IXEOI
1 ALPHA J FC?C 1 ALPHA J

23 19 FC?C 23 Was the input an ALPHA? ...


IGroJ 01 20 GTO 01 ... yes , goes to l LBLJ 01.
1ALPHA1 1 Asro lGJ x 21 ASTO X No , places the input into the
l ALPHA 1 X-register.
10.01501 22 10.01501-
lsroJ 02 23 STO 02 Stores the loop control number into
Ro2
I LBLJ 02 24 LBL 02
~ 25RDN
IRcLJ 02 26 RCL IND 02 Recal ls the letter in the indirectly
addressed regis ter.
Flags 221

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

IHEX I ( [El ) INPUT?


i ALPHA l F i ALPHA 1
IRIS 1 15.0000
222 Flags

Range Error and Error Ignore Flags


Two flags in the HP-41 C can be used to control how the calculator reacts to range errors
(overflows and underflows) and a li operating errors. Flag 24 is the range error ignore flag
and flag 25 is the error ignore flag . These flags provide excelle nt e rror detection and hand-
ling in your programs.

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.

Specifically , a range e rror is an overflow where a number is generated that exceeds


9 .999999999 x 1099 . Underflows (numbers closer to zero than 1 X 10- 99) do not
cause the OUT OF RANGE message to be displayed. Zeros are placed into the affected regis-
ter. Other range errors that can be ignored by flag 24 are Iisted in appendix E.

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

Store 1 x 1010 in Ros

Store 1 x 1O' in R06

Recall Ros

Display Ros

Multiply Ros by 1 X 1010


& store result in Ros

Recall R06

Display R06

Divide R06 by 1 x 10'


& store result in 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

0.0000 00 Press and hold 1R/ S1 to stop the


program.
Flags 225

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

Audio Enable Flag


Flag 26 is used to contro l the audible tone in the HP-41 C. When fl ag 26 is set , the HP-41 C
audible to ne will operate . Whe n you clear fl ag 26, the aud ible to ne w ill not o perate.
You can se t , clear and test flag 26, just like any of the general or s pecial purpose flags. But
you sho uld re me mber that thi s fl ag a lso controls the operat ion o f the audi ble to ne . Flag 26
is the onl y user fl ag that is auto mati cally set (so that the audible tone functions) each time the
HP-41 C is tumed on .
228 Flags

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

Now load the program.

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.

USER Mode Flag


This flag (flag 27 ) is used to place the calc ulator into and out of USER mode . When flag 27
is set, the HP-41C is placed into USER mo de. When cleared, the HP-41C is taken out of
USER mode .
You can set , c lear and test flag 27 just like a general purpose flag, but keep in mind that thi s
flag also control s USER mode.
The statu s of flag 27 , whether clear or set , is maintained at ali times by Continuous Me m-
ory, even when the calc ulator is tumed off and o n.

Number Display Control Flags


Two flags, the decimal poi nt fl ag (28) and the di gi t group ing fl ag (29) are used to control
how num bers appear in the HP-4 1C display .
The decimal point flag (flag 28) contro ls the radix mark a nd the separator mark in a
number. A radix mark is the di vider between the integer portion of a number and the frac-
tional portion of a numbe r. The separator mark is the separator between groups of dig its in a
large numbe r.

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 .

HP-41 C System Flags


Flags 30 through 55 are a ll used by the HP-4 1C system to control the calculator's intemal
operation. Sorne have little value to you, and ali can only be tested. Follow ing is a listing
and short desc ription o f each system fl ag.
Catalog Flag (flag 30). As with all of the system fl ags, flag 30 can be tested only . lt is used
intemally for the operation of the catalog feature and a lways tests clear for you .
Peripheral Flags (Oags 31 through 35). These flags are used intemally for the operation of
certain periphe ral extensio ns.
Number of Digits (Dags 36 through 39). These four fl~in combination, are used
intemally to set the number of displayed decimal digits in l.!.!..!J , ~ and IENGI display
formats. The number of decimal digits is determined by the following chart.

Flag status (clear = O, set = 1)


No. of digits 36 37 38 39
o o o o o
1 o o o 1
2 o o 1 o
3 o o 1 1
4 o o o
5 o o 1
6 o 1 o
7 o 1 1 1
8 o o o
9 o o
232 Flags

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.)

1Clear flag 1 Set flag

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)

Store A-Finto R,0-R, ~

Clear flags 22 & 23

Store O in input counter

No

Using loop control


number as register address.
recall ALPHA stored in
indirectly addressed register
Add to
number
in R03

lncrement A02 by 1,
stop it greater Display
than lS(Use ~ ) result

Recatl integer portien


of loop control number
(Same as decimal equivalent
of ALPHA stored in that register)
B
Flags 235

He re is a solut ion to problem 4.

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

(This page intentionally left blank.)


Appendix A

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

HP-41 C Optional Accessories


HP 82143A Therrn al Printer. 82143A e/'
HP 82104A Card Reader. 82104A ....-
HP 82153A Optical Wand 82153A
HP 82106A Memory Modules (not for use with the HP-41CV). 82106A
HP 82170A Quad Memory Module (not for use with the HP-41CV). 82170A
Application Modules. (Refer to the HP-41C Accessory Brochure
for ti tles.)
Recha rgeable Battery/ Reserve Power Pack (Recharged from 82120A i.--

the HP 82059B Recharger/ AC Adaptor- not included; sold


with the system printer or available asan optional accessory.)
Printer Paper. (For HP 82143 Printer.) 82045A
Magnetic Cards . (For HP 82104A Card Reader.)
40 Blank Cards With Holder 00097-13141
120 Blank Cards With Holders 00097-13143
1000 Blank Cards 00097-13206

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

Maintenance and Service

Your Hewlett-Packard Calculator


You r calculator is anothe r example of the award-winning design , superior quality , and
atte ntion to detail in engineering and construction that have marked Hewlett-Packard e lec-
tron ic instruments for more th an 30 years . Each Hewlett-Packard calculator is precision
crafted by people who are dedi cated to giv ing you the best possible product at any price.
After construction, every calc ula tor is thoroughl y inspected for electrical, mechanical , and
cosmetic flaws .

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.

Ali plug-in ex te nsions sho uld be handled with care .


1. Keep the contact area free of obstruct ions. Should the contacts become dirty,
carefully brush or blow the dirt oul of 1he cont act area. Do not use any liquid 10 clean
the contac1s or exte nsions.
2. Store the extensio ns in a clean dry place . Do not place plug- in exte nsions in a pocket
unless they are protected in their case. Static electricity could damage the extension.
3 . Always tum the HP-4 1C off before inserting or removing any plug-in extension .
Failure to do so could da mage both the calculator and the extensio n.

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.

Everready E90 Mallory MN9 l 00 UCAR E90


National AMS(s) Panasonic AMS(s) VARTA 7245

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

Replacing the Batteries


The Continuo us Memory of your HP-41 C will normally be preserved for about 30 to 60
seconds while the batteries are out of the calculator. Howeve r, you must turn the calculator
off before removing the batteries in order to pre erve Continuous Memory . This gives you
ample time to replace the batterie wit h new one . Leavi ng batteries out of the calculator for
extended periods will result in loss of the information in Continuous Memory.
To replace the batte ries, use the following procedure (you may want to read through the
entire battery replace ment procedure prior to replac ing the batteries):

1. Tum the calculator off.

2 . Tum the calculator over in your ha nd and


push up on the lip o n the battery holder as
shown in the photograph .

3. Re move the batteries from the battery holder,


making sure you do not mix them up with the
new batteries .

4 Look at the polarity marks on the end of the


battery holder. It shows how the batteries
should be inserted into the battery holder.
lnsert the new batteries, and carefully note
the position of each battery. If any of the
batteries are inserted wrong, the calculator
will not tum on.
242 Maintenance and Service

5 . Insert the battery holde r into the calculator


such that the exposed ends ofthe batte ries are
pointing toward the input/output ports.

6 . Push the upper edge ofthe ba ttery ho lder into


the calculator until it goes no furthe r. The n
snap the lower edge ofthe holder into place.
If any of the batteries are inserted incorrectly, the calculator may not turn on. If, whe n you
insert the new batteries the calculato r fa ils to turn on, immediately remove the battery holder
a nd check the position of the batte ries. The calculator cannot be damaged by inserting the
batteries wrong; it simply will not function.

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.

Limited One-Year Warranty


What We Will Do
The HP-41 C, the HP-41 CV, and their accessories (except software, the batteries, and
damage caused by the batteries) are warranted by Hewlett-Packard against defects in
materials and workmanship for one year from the date of original purchase. If you
sell your calculator or give itas a gift, the warranty is automatically transferred to the
new owner and remains in effect for the original one-year period . During the
warranty period we will repair or, at our option, replace at no charge a product that
proves to be defective provided that you return the product, shipped prepaid, to a
Hewlett-Packard repair center.

What Is Not Covered


The batteries or damage caused by the batteries are not covered by this warranty. However,
certain battery manufacturers may arrange far the repair of the calculator if it is damaged
by the batteries. Contact the battery manufacturer first if your calculator has been damaged
by the batteries.
This warranty does not apply ifthe product has been damaged by accident or misuse, oras a
result of service or modification by other than an authorized Hew lett-Packard repair center.
Hewlett-Packard shall have no obligation to modify or update products once sold.

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.

Warranty lnformation Number


If you have any questions concerning this warranty please call toll-free (except in
Alaska, Hawaii, and Oregon) (800) 547-3400. In Oregon call 757-2000.
244 Ma1ntenance and Serv1ce

How to Obtain Repair Service


Hewlett-Packard maintains repair centers in most major countries throughout the world.
You may have your calculator repaired ata Hewlett-Packard repair center anytime it needs
service, whether the unit is under warranty or not. There is a charge for repairs after the one-
year warranty period . Please refer to Shipping Instructions.
The Hewlett-Packard United States repair center for handheld and portable printing
calculators is located in Corvallis, Oregon. The mailing address is:

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.

All shipping, reimportation and duty arrangements are your responsibility .

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 .

Programming and Applications


Should you need techn ical assistance conceming programming , calculator applications,
etc., call Hewlett-Packard Customer Support at 503/757-2000. This is not a toll-free num-
ber, a nd we regret that we cannot accept collect calls. As a n alte rnati ve, you may write to:
HEWLETT-PACKARD
COR VALLIS DIVISION CUSTOMER SUPPORT
1000 N .E . CIRCLE BOULEVARD
COR VALLIS , OR 97330
A great number of our users submit program applications or unique program key sequences
to share with other Hewlett-Packard owners. Hewlett-Packard will only consider using
ideas give n freely to us. Since it is the policy of Hewlett-Packard not to accept suggestions
given in confidence, please include the following statement with your submittal:
" Ali information stated within is submitted to Hewlett-Packard Compa ny without any
confidentiality or obligation. 1am submitting this information freely to Hewlett-Packard for
their disposition."
246 Maintenance and Service

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

Stack Lift Conditions


and
Termination of Keyboard Entry

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 .

Termination of Digit and ALPHA String Entry


Except for those operations used for digit entry ((~] .1 CHS I , 1EEX1 , E3 , 1useR 1, 1 ALPHA 1.
), ali operations in the HP-41 C terminate di g it entry. This means that the calculator
knows that any digits you key in after any of these operations are part of a new number. The
new number will be written over the number in the X-regi ster. However, depend ing on the
particular operation, the stack may first be ' 'lifted' so that the contents of the X-register are
copied into the Y-register before the new number is keyed into the X-register.
ALPHA entry is terminated by a li other functions except 1AACL 1 . To continue building an
ALPHA string after ALPHA entry is terminated , simply press IAPPENol.

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 Storage Requirements


and LAST X Operations

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

(This page intentionally left blank.)


Appendix E

Messages and Errors


Following is a listi ng of ali messages and errors that you might see in the HP-4 1C display.

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

An attempt was made to execufe a specific print function when the


printer was not connected to the system .
NULL Keystroke was nullified by holding the key down for longer than
about a half second.
PRIVATE Refer to the owner's handbook provided with the HP 82104A Card
Reader.
An attempt was made to view a private program .
OUTOF RANGE A number has exceeded the computational or storage capability of
the HP-41C.
Overflow = 9.999999999 99
ISDEvl where the standard deviation of x(Sx=VM/(n(n-1)])
or y (S:r=YN / [n(n-I)]) results in division by zero or
the square root of a negative number. (M =nix2 -(Ix)2;
N=niyL(!.y)2.)
1FACT 1 where x> 69.
PACKING Program memory is being packed.
TRY AGAIN As a result of a packing operation, the last keystroke sequence must
be repeated. This could be an lxEOI, lsNI , IGrolGJGJ , orwhen an
attempt is made to insert an instruction into a program.
YES The answer to flag test when test is true. Also the answer to condi-
tionals when relationship between x and O or y is true.
NO The answer to flag test when test is false . Also the answer to condi-
tionals when relationship between x and O or y is false.
RAM An attempt was made to lcoPv l a program in RAM (random access
memory- a memory module, or interna( memory) to RAM .
ROM An attempt was made to 1DEL I, (CLP 1, E3, or insert in to a program
that is currently in ROM (read only memory-an application
module).
Appendix F

HP-41C/41CV Extensions

The system capabilities of your calculator can be greatly expanded by connecting it


to one or more peripheral devices. These system extensions enable you to customize
your computational system to suit your particular requirements. You can
supplement the standard features of your calculator with:
Magnetic card input and output. Memory Modules for increased
Printer output. program and data storage capacity
Optical Wand input. (not for use with the HP-41 CV).
Extensive applications libraries. Input and output through other
peripheral devices.
Four input/ output (I / O) ports are provided on the calculator for plugging in these
devices. To give you a feel for the remarkable power you can achieve by adding to
your calculator, let's look briefly at sorne of the devices available.

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 82104A Card Reader


Using the HP 82104A card reader, you specify individual programs you wish to
record from Continuous Memory onto a magnetic card. Each card can contain up to
32 registers of program instructions or 32 storage registers. A program or group of
registers need not be limited in length to the capacity of a single card, though; it can
be segmented among as many cards as necessary. You don't have to determine
whether more than one card is required for reading or writing; the calculator does
that for you automatically, then tells you by displaying a message.
The card reader will even record key reassignments, so all you do is set the calculator
to US ER mode, read in the card or cards, and begin. And if you would like to assure
the "privacy" and "security" of your recorded programs, you can instruct the card
reader to record a card so that the program on that card can only be executed and not
viewed or altered (under normal operating circumstances).
With an HP 82104A Card Reader, you are not limited to reading programs or data
on magnetic cards that you have recorded yourself. Your calculator has been
specifically designed to accept programs or data from magnetic cards recorded on an
HP-67 or HP-97. This will allow you to utilize the vast number of specialized
programs available from the HP-67/ HP-97 Users' Library.
257
258 HP-41 C and HP-41 CV Extens1ons

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.

HP 82153A Optical Wand


The wand provides a rapid, convenient, and inexpensive meaos of inputting HP-41 C
programs and data. By scanning rows of bar code, programs and data can be loaded
much faster than by key entry. Bar code represents the most inexpensive means of
access to HP's vast HP-41C program library. Practically ali HP-41C programs are
available in bar code, including Users' Library and Solutions Books programs. Bar
code can also be conveniently duplicated and distributed. Reproduction is possible
by high-quality copier or offset printing. For users who wish to create custom bar
code programs, Hewlett-Packard has arranged for inexpensive bar code production
through an independent firm.

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.)

Hewlett-Packard Application Modules


If yo u 're a specialist interested in preprogrammed solutions for problems in a specific
field , an HP application module can greatly enhance your calculator's usefulness.
Available in a variety of disciplines, HP application modules each contain a number
of professionally developed programs. These modules quickly transform your
calculator into a special-purpose machine designed to solve complex problems in
your field at the touch of a few keys. Up to four application modules can be plugged
into the 1/ 0 ports on the HP-4IC or HP-41CV. While a module is plugged in, the
names of ali programs contained in the module can be displayed by pressing
I CATALOG l 2.
Appendix G

Advanced Programming and Operation

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.

Here are sorne more examples:

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

The [coPv 1 Function


lcoPv 1 is used to copy a program from an application module into program memory. With
the application module in place and the desired program name in mind , execute lcoPvl and
spell out the program name. This will copy the specified program into program memory.
Advanced Programming and Operation 261

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

Attempting to 1COPY1 a prograrn from program memory to another location in program


memo ry will result in the RAM message (RAM means Random Access Memory-these are
the storage registers that you can store data and program instructions into). Attempting to
Ion I, 1CLP I , 8, or insert into a program that is currently in an application module will
result in the ROM display (ROM means Read Only Memory - this is what application
modules are stored in).
You may copy the application module program to which the calculator is presently posi-
tioned by not specifying a program name. For example, lcoPvl 1ALPHA11ALPHA1 copies
the application module program that the calculator is currently positioned to into program
memory.
Index

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).

DEC Octal to decimal conversion (page 105).


DEG Degrees mode (page 85).
DEL Delete program memory lines. Requires 3-number input
(page 137). Not programmable.
DSE Decrement and skip if equal. Requires 2-digit, stack,
indirect 2-digit, or indirect stack address (page 164).
IEEXI Enter exponent (page 21, 77).
END End of program (page 118, 178).
ENG IENGI Engineering notation display. Requires 1-digit, indirect
2-digit, or indirect stack address (page 34).
ENTER j IENTERI Enter number in X-register into Y-register (page 46).

EjX ~ Natural antilogarithm (page 96).


272
EfX-1 Natural antilogarithm for arguments close to zero (page
96).
FACT Factorial (page 81 ).
FC? " Flag clear" test. Requires 2-digit, indirect 2-digit, or
indirect stack address (page 209).
FC?C " Flag clear" test and clear. Requires 2-digit, indirect
2-digit, or indirect stack address (page 209).
FIX Fixed point display. Requires 1-digit, indirect 2-digit, or
indirect stack address (page 32).
FRC Fractional portion of number (page 79).
FS? " Flag set" test. Requires 2-digit, indirect 2-digit, or
indirect stack address (page 209).
FS?C " Flag set" test and clear. Requires 2-digit, indirect 2-digit,
or indirect stack address (page 209).
GRAD Grads mode (page 85).
GTO Go to. Requires 2-digit label, ALPHA program name,
indirect 2-digit, or indirect stack address (page 159).

GTO. Go to line number. Requires 3-number input or ALPHA


label (page 128, 134). Not assignable, not programmable.
GTO.. Go to end of program memory and prepare calculator for
new program (page 112). Not programmable , not
assignable.
HMS Decimal hours to hours, minutes, seconds conversion
(page 88).

HMS+ Hours, minutes, seconds addition (page 90).


HMS - Hours, minutes, seconds subtraction (page 90).
HR Hours, minutes, seconds to decimal hours conversion
(page 88).
INT lnteger portion of number (page 79).
ISG l 1sGI lncrement and skip if greater. Requires 2-digit, stack,
indirect 2-digit, or indirect stack address (page 164).
LASTX 1LASTX1 Recalls LAST X register contents to X-register (page 52).
LBL ILBLI Label program . Requires 2-number label or ALPHA
program name (page 11 O).
LN ~ Natural logarithm (page 96).
LN1+X Natural logarithm for arguments close to one (page 96).
LOG IL.OGI Common logarithm (page 96).
MEAN Mean (page 101 ).
MOD Modulo (remainder) operator (page 79).
OCT Decimal to octal conversion (page 105).
273
OFF Power off (page 106).
Power on/off key (page 15). Not programmable or
assignable. Refer to ON and OFF.
ON Power on ( continuous) function (page 106). Not
programmable.
P-R Polar to rectangular conversion (page 94).
PACK Pack program memory (page 141 ). Not programmable.
% Percent (page 83).
%CH Percent of change (page 84).
PI 0 Pi (page 82).

PROMPT
'"'"'
mode key
Program mode key (page 106, 112). Not programmable.

Prompt (page 151 ).


PSE Pause (page 147).
Rf Roll up (page 44).
R-D Radians to degrees conversion (page 87).
R-P Rectangular to polar conversion (page 93).
Run/stop. Stops running program or starts a stopped
program (page 145, 147).
RAD Radians mode (page 85).
RCL Recall. Requires 2-digit, stack, indirect 2-digit, or indirect
stack address (page 68).

RDN Roll down (page 44 ).


RND Round (page 78).
RTN Return (page 1n, 178).
SCI Scientific notation display. Requires 1-digit, indirect
2-digit, or indirect stack address (page 33).
SDEV Standard deviation (page 101 ).
SF Set program flag . Requires 2-digit, indirect 2-digit, or
indirect stack address (page 209).
I+ Accumulations for statistics (page 99).
I- Accumulation correction (page 103).
I REG Statistical register block specification. Requires 2-digit,
indirect 2-digit, or indirect stack address (page 99).
SIGN Sign, unary of x (page 85).
SIN Sine (page 86).
SIZE Size of register configuration (allocation). Requires 3-
number input (page 73, 117). Not programmable.
SQRT Square root (page 81 ).
274
SST lssrl Single step (page 129, 132). Not programmable.
ST+ lsrol11] Storage register addition. Requires 2-digit, stack, indirect
2-digit, or indirect stack address (page 74).

ST- lsrolG Storage register division. Requires 2-digit, stack, indirect


2-digit, or indirect stack address (page 74).

ST* lsrol@ Storage register multiplication. Requires 2-digit, stack,


indirect 2-digit, or indirect stack address (page 74).

ST/ lsrolGJ Storage register division. Requires 2-digit, stack, indirect


2-digit, or indirect stack address (page 74).
STO lsrol Store. Requires 2-digit, stack, indirect 2-digit, or indirect
stack address (page 68).

STOP (1 R/S1) Stops program execution (page 145).


TAN ITANI Tangent (page 86).

TONE Tone of beeper. Requires 2-digit, indirect 2-digit, or


indirect stack address (page 104).
luSERI USER mode key (page 63). Not programmable or assign-
able.

VIEW lv1ewl View register contents. Requires 2-digit, stack, indirect


2-digit, or indirect stack address (page 72).
X= O? lx=o?I X equal to O conditional test (page 170).

X~ O? X not equal to O conditional test (page 171).


X< O? X less than O conditional test (page 171 ).
X<=O? X less than or equal to O condilional test (page 171 ).

X> O? X greater than O conditional test (page 171 ).


X= Y? l x=Y?I X equal to Y conditional test (page 170).
X~ Y? X not equal to Y conditional test (page 1_71 ).
X< Y? X less than Y conditional test (page 171 ).
X<= Y? lx:i;J?I X less than or equal to Y conditional test (page 171 ).
X> Y? lx>y1l X greater than Y conditional test (page 171 ).
X<> Exchange contents of X-register with any other register.
Requires 2-digit, stack, indirect 2-digit, or indirect stack
address (page 105).

X<>Y 1X~YI Exchange X- and Y-registers (page 44).


XEQ lxeol Execute. Requires program or function name, la bel
number or indirect address (page 57, 114, 1n).
Xf 2 ~ Square (page 82).
Yf X ~ Exponential (page 97).

275
-

..

F//-p9 HEWLETT
~~ PACKARD

1000 N.E. Circle Blvd., Corvellis, OR 97330

00041 - 90313 Printed in U.S.A.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy