HP-19C Programmable Calculator
When my HP-42S broke down in 1998, one of my colleagues (also my former
grad supervisor) gave me his broken HP-41CX and HP-19C. I described how I
repaired the 41CX in another article. Here we'll
take a look at the 19C.
The HP-19C was one of a matched pair of high-end programmables in HP's "20
Series" of calculators. The 19C was the printing version of the 29C, which in
turn was an improvement over the similar looking 25C. With the exception of the
printing functions, the 19C and 29C shared the same keys, although in a
different arrangement.
The programming capabilities of the 19C (and 29C) were impressive, with space
for 98 fully merged keystrokes, and 30 memory registers. Although these
calculators lacked a card reader for permanent storage, both had continueous
memory that would retain the most recently entered program and 16 of the 30
registers even when the calculator was turned off (a feature taken for granted
today).
This calculator, in addition to offering a full suite of scientific and
statistical functions, had very powerful programming constructs. There were
eight different conditional tests (four x versus y and
four x versus 0), increment and decrement instructions, three levels
of subroutines, and indirect addressing of both registers and branch targets.
Branching was done using labels, but indirect branching also supported relative
jumps. Program editing was made easy by automatic insertion, and a
DEL key.
At the time that this calculator was new, I was thirteen years old and had
never heard of HP calculators. Instead, I had a
Commodore PR100 with 72
unmerged program steps and 10 memories, which falls far short of what the 19C
can do. Of course, the Commodore cost far less as well, and I spent hundreds of
enjoyable hours writing programs for it.
|
|
|
|
The back label contains a list of useful conversion factors.
|
Now, thirty years later, the HP-19C is the calculator I use most often. It sits
on my desk at work, and gets used several times a day for quick calculations.
I've also written an equation solver program for it, which is reproduced at the
end of this article.
Repairs
As I mentioned in the introduction, my HP-19C required some repairs when I
first received it. It needed a new battery pack, the keyboard had become
unplugged from the main CPU board, and the tabs on the battery cover were
damaged (almost broken off).
I fashioned a new battery pack out of 1100mAh Sanyo NiCd cells. These were
state-of-the-art in 1998, and had far more capacity than the original HP
battery pack (which I think was 250mAh). Rather than rely on pressure
to maintain a connection with the battery contacts, I soldered the battery
pack leads directly to the terminals in the calculator.
|
|
|
My home-made 1100mAh 4.8V battery with leads soldered in place.
|
This calculator was really designed to be disassembled. The back cover comes
off after removing a few screws, and the various sub-assemblies inside just
plug together. When I received the calculator, the keyboard wasn't properly
plugged into the main board (the result of an earlier repair attempt), but it
was a simple matter to align the pins and put it back together.
The battery compartment cover has small tabs that hold the cover in place.
These were almost broken off by someone attempting to force the cover closed. I
repaired these by carefully straightening them, and then running a hot
soldering iron along the crease to soften the plastic. The tabs are not as
strong as they once were, but they are fairly solid. A piece of foam rubber on
the opposite end of the cover keeps it securely in place.
What About the Printer?
The printer on my HP-19C sort of works, except for two problems: two of the
print element dots are cracked, and I can't get any paper for it anyway. I cut
some appropriately narrow strips of paper from a roll of thermal fax paper to
test the printer, and noticed two rows of dots missing. Upon disassembling the
printer, hoping to find a loose connection, I discovered cracks in two of the
print head's heating elements. Testing with an Ohm-meter confirmed that these
were open-circuit. But even without the printer, this makes a nice desktop
scientific calculator.
An Equation Solving Program
One feature of the HP-42S that I missed was the equation solver, so I set out
to write a simple one for the 19C. I submitted it to the
Museum of HP Calculators, and it now
appears in their software library. I've also reproduced it here.
The HP-42S has a solver where you can provide a program for an equation of
n variables, fix any n-1 of these variables, and solve for
the remaining one.
The solver uses the secant method, in which the two most recent guesses are
used to define a line. The point where the line intercepts the x-axis is
used as the next guess. When two consecutive guesses are the same, the solution
has been found. I'm sure this solver is not as good as the one in the HP-42S,
but it works sufficiently well for my purposes. It can get into an infinite
loop on periodic functions, like sin(x).
Usage
Using the solver is simple. First, rearrange your equation so all the terms
are on one side. In other words, rewrite it in the form
f(a1,...,an) = 0.
Next, enter the equation as a subroutine with label 9. The parameters are
represented by the like-numbered registers (i.e. a1 is
in register 1, and so on).
To solve for any one parameter, store values for all the other parameters
in the appropriate registers, enter two initial guesses for the parameter
you wish to solve for, enter the parameter number, and press GSB 0.
See the sample problem for more details.
Program Listing
LINE KEYSTROKES COMMENTS
01 g LBL 0 -main entry point
02 STO 0 -store index of variable to solve for
03 R↓
04 STO .2 -store second guess
05 R↓
06 STO .1 -store first guess
07 STO i -compute f1 = f(R1,..,Ri1,..,Rn)
08 GSB 9
09 STO .0
10 RCL .2 -compute f2 = f(R1,..,Ri2,..,Rn)
11 STO i
12 g LBL 1
13 GSB 9
14 STO .2
15 RCL .1 -compute Ri2 <- (Ri1 f2 - Ri2 f1) / (f2 - f1)
16 ×
17 RCL i
18 STO .1 -move old Ri2 to Ri1 while we're here
19 RCL .0
20 ×
21 -
22 RCL .0
23 RCL .2
24 STO .0 -move old f2 to f1 while we're here
25 x↔y
26 -
27 ÷
28 STO i -save new value for Ri2
29 RCL .1 -compare to previous guess
30 f x≠y -keep going until they're the same
31 GTO 1
32 g RTN
Registers
|
R0
|
Index i of variable to solve for
|
|
R1...R9
|
Variables to solve for (up to 9)
|
|
R.0
|
Previous value for
f(R1,..,Rn)
|
|
R.1
|
Previous value of Ri
|
|
R.2
|
Second guess during initialization. Current value for
f(R1,..,Rn) during main loop
|
Sample Problem
The net resistance, R3, of two parallel resistors of resistance
R1 and R2 is given by:
|
R3
|
=
|
R1 R2
|
|
-------------
|
|
R1 + R2
|
This can be rewritten in the form
f(R1,R2,R3) = 0 as follows:
|
R1 R2
|
-
|
R3
|
=
|
0
|
|
-------------
|
|
R1 + R2
|
The following subroutine implements this equation:
LINE KEYSTROKES COMMENTS
33 g LBL 9 -solver uses subroutine with label 9
34 RCL 1
35 RCL 2
36 ×
37 RCL 1
38 RCL 2
39 +
40 ÷
41 RCL 3
42 -
43 g RTN
What is the resistance of a 5kΩ and 10kΩ resistor in parallel?
|
KEYSTROKES
|
DISPLAY
|
COMMENTS
|
|
5 STO 1
|
5.0000
|
Store 5 in R1
|
|
10 STO 2
|
10.0000
|
Store 10 in R2
|
|
3 ENTER
|
3.0000
|
First guess is 3
|
|
4 ENTER
|
4.0000
|
Second guess is 4
|
|
3 GSB 0
|
3.3333
|
Solve for R3
|
The answer is 3.3333kΩ. What resistance is needed in parallel with a
10kΩ resistor to give a 2kΩ parallel resistance?
|
KEYSTROKES
|
DISPLAY
|
COMMENTS
|
|
2 STO 3
|
2.0000
|
Store 2 in R3 (R2 is still 10 from the previous problem)
|
|
3 ENTER
|
3.0000
|
First guess is 3
|
|
4 ENTER
|
4.0000
|
Second guess is 4
|
|
1 GSB 0
|
2.5000
|
Solve for R1
|
The answer is 2.5kΩ. If the program cannot find a solution, it will
eventually end up dividing by zero, which will display Error. For
example, what resistance is needed in parallel with a 10kΩ resistor to
give a 12kΩ parallel resistance?
|
KEYSTROKES
|
DISPLAY
|
COMMENTS
|
|
12 STO 3
|
2.0000
|
Store 2 in R3 (R2 is still 10 from the previous problem)
|
|
3 ENTER
|
3.0000
|
First guess is 3
|
|
4 ENTER
|
4.0000
|
Second guess is 4
|
|
1 GSB 0
|
Error
|
Solve for R1
|
It's not possible to put something in parallel with a 10kΩ resistor and
end up with a higher resistance.
|
|
|
|
Buy Stefan a coffee!
If you've found this article
useful, consider leaving a donation
to help support
Stefan's Historical Computing Devices.
|
|
|
|
|
Last updated Saturday April 12, 2008.
|
E-mail Stefan
|
|
|
|
Disclaimer:
Although every effort has been made to ensure accuracy and
reliability, the information on this web page is presented without
warranty of any kind, and Stefan Vorkoetter assumes no liability for direct or
consequential damages caused by its use.
It is up to you, the reader, to determine the suitability of, and
assume responsibility for, the use of this information.
Copyright:
All materials on this web site, including the text, images, and HTML
mark-up, are Copyright © 2008 by Stefan Vorkoetter unless
otherwise noted. All rights reserved. Unauthorized duplication
prohibited. You may link to this site or pages within it, but
you may not link directly to images on this site, and you may
not copy any material from this site to another web site or
other publication without express written permission. You may make
copies for your own personal use.
|
|