# HP-19C Programmable Calculator

November 22, 2007

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

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.

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, and it’s the one I keep on my desk at the office.

## 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, so I wanted mine to have the same flexibility.

My 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 the left hand side. In other words, rewrite it in the form `f`(`a`_{1},…,`a _{n}`) = 0.

Next, enter the left hand side as a subroutine with label 9. The variables are represented by the like-numbered registers (i.e. `a`_{1} is in register 1, and so on).

To solve for any one variable, store values for all the other variables in the appropriate registers, enter two initial guesses for the variable you wish to solve for, enter the variable number, and press `GSB 0`.

See the sample problem for more details.

### Program Listing

Line | Instruction | Comments |
---|---|---|

001♦ | LBL 0 | Main entry point |

002 | STO 0 | Store index of variable to solve for |

003 | R↓ | |

004 | STO .2 | Store second guess |

005 | R↓ | |

006 | STO .1 | Store first guess |

007 | STO i | Compute f = f(_{1}R,..,_{1}R,..,_{i1}R)_{n} |

008 | GSB 9 | |

009 | STO .0 | |

010 | RCL .2 | Compute f = f(_{2}R,..,_{1}R,..,_{i2}R)_{n} |

011 | STO i | |

012♦ | LBL 1 | |

013 | GSB 9 | |

014 | STO .2 | |

015 | RCL .1 | Compute new R = (_{i2}R _{i1}f – _{2}R _{i2}f) / (_{1}f – _{2}f)_{1} |

016 | × | |

017 | RCL i | |

018 | STO .1 | Move old R to _{i2}R while we’re here_{i1} |

019 | RCL .0 | |

020 | × | |

021 | − | |

022 | RCL .0 | |

023 | RCL .2 | |

024 | STO .0 | Move old f to _{2}f while we’re here_{1} |

025 | x↔y | |

026 | − | |

027 | ÷ | |

028 | STO i | Save new value for R_{i2} |

029 | RCL .1 | Compare to previous guess |

030 | x≠y? | Keep going until they’re the same |

031 | GTO 1 | |

032 | RTN |

### Registers

Register | Use |
---|---|

0 | Index i of variable to solve for |

1-9 | Variables to solve for (up to 9) |

.0 | Previous value for f(R,..,_{1}R)_{n} |

.1 | Previous value of R_{i} |

.2 | Second guess during initialization. Current value for f(R,..,_{1}R) during main loop_{n} |

### Sample Problem

The net resistance, `R _{3}`, of two parallel resistors of resistance

`R`and

_{1}`R`is given by:

_{2}R
_{3} |
= | R _{1}R_{2} |

------------- | ||

R + _{1}R
_{2} |

This can be rewritten in the form `f`(`R _{1}`,

`R`,

_{2}`R`) = 0 as follows:

_{3}R _{1}R
_{2} | – | R
_{3} |
= | 0 | |

------------- | |||||

R + _{1}R
_{2} |

The following subroutine implements this equation:

Line | Instruction | Comments |
---|---|---|

033♦ | LBL 9 | Solver uses subroutine with label 9 |

034 | RCL 1 | |

035 | RCL 2 | |

036 | × | |

037 | RCL 1 | |

038 | RCL 2 | |

039 | + | |

040 | ÷ | |

041 | RCL 3 | |

042 | − | |

043 | RTN |

What is the resistance of a 5kΩ and 10kΩ resistor in parallel?

Description | Keystrokes | Display |
---|---|---|

Store 5 in R1 | 5 STO 1 | 5.0000 |

Store 10 in R2 | 10 STO 2 | 10.0000 |

First guess is 3 | 3 ENTER | 3.0000 |

Second guess is 4 | 4 ENTER | 4.0000 |

Solve for R3 | 3 GSB 0 | 3.3333 |

The answer is 3.3333kΩ. What resistance is needed in parallel with a 10kΩ resistor to give a 2kΩ parallel resistance?

Description | Keystrokes | Display |
---|---|---|

Store 2 in R3 (R2 is still 10 from the previous problem) | 2 STO 3 | 2.0000 |

First guess is 3 | 3 ENTER | 3.0000 |

Second guess is 4 | 4 ENTER | 4.0000 |

Solve for R1 | 1 GSB 0 | 2.5000 |

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?

Description | Keystrokes | Display |
---|---|---|

Store 2 in R3 (R2 is still 10 from the previous problem) | 12 STO 3 | 2.0000 |

First guess is 3 | 3 ENTER | 3.0000 |

Second guess is 4 | 4 ENTER | 4.0000 |

Solve for R1 | 1 GSB 0 | Error |

It’s not possible to put something in parallel with a 10kΩ resistor and end up with a higher resistance.

## Related Articles

If you've found this article useful, you may also be interested in:

Buy Stefan a coffee! If you've found this article

useful, consider
leaving a donation to help support

stefanv.com

**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. Links to
Amazon.com merchandise are provided in association with Amazon.com.
Links to eBay searches are provided in association with the eBay
partner network.

**Copyright:** All materials on this web site, including the
text, images, and mark-up, are Copyright © 2022 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.

Gordie Lange

November 10, 2008

I have been using my HP-19C since I obtained it new and in the box while I was a chief engineer at Hughes. I particularly liked, and still do, the "reverse polish" notation system rather than the more common algebraic notation found in most units today. The article is well written and accurate. I substituted nickel metal hydride batteries when I could no longer get HP replacements. They too far outlast the original NiCads. I do remove them to charge them in a quick charger however. Although the equation solver program is quite interesting, since I am long since retired I will probably never use it. Still I throughly enjoyed the article.

Richard Holdsworth

January 25, 2009

Great fun. I have had a first- then second-hand HP19C since 1980 when I was a student. The battery died circa 1982 and I was unable to get a replacement. Reading your article inspired me somewhat so I purchased 4 NiCd solar light batteries from the hardware store and broke open the battery pack by cutting the pack seal in the front adjacent to the contacts. In with the new cells, cut and add some sheet metal contacts, position ye olde springs and a few twirls of duct tape. Guess what it works like a charm!! Even the bl**dy printer with paper that’s been in there for a quarter of a century works perfectly.

Have a good one, mate.

JensE

September 04, 2019

BTW: Because R3 = (R1 R2) / (R1 + R2) is equal to R3 = 1 / (1/R1 + 1/R2), the shorter program would be:

Stack

y: R1

x: R2

Programm

LBL A

1/x

xy

1/x

+

1/x

RTN

Stefan Vorkoetter

September 04, 2019

Shorter, but it will fail if one of the inputs is zero. The original code will still work if one input is zero (but may fail if both are zero; I don’t recall what happens on the 19C if you divide zero by zero).

William

March 16, 2020

Have two HP 19C calculators. Can not figure out how to get paper into the printer. Followed the directions in the manual, but the paper will not push through. The second calculator, the printer printing head keeps going back and forth and will not stop. Can anyone help me with these problems with the calculators?

Thanks, William

John

February 22, 2021

Same as William above. Printer head keeps going back and forth. This is because the motor is constantly under power. I could not find any other solution than to break the internal red lead connected to the motor. I have paper for the printer but would really like to have a solution so as to restore printer operation.

Paul

April 05, 2021

Same problem, printer head keeps moving back and forth and paper is advancing. Can’t get it to stop. Otherwise calculator appears to function normally. Any ideas? Open up and disconnect printer?