The HP-34C Is A Programmable Calculator

I'm sorry, I couldn't help myself, I had to do this. Because the HP-34C is a programmable calculator, it could be helpful to have some more or less useful programs or snippets of programs lying about. This page is just a start to collect my HP-34C programs, just for the fun of it.
But how do I document them? In order to make it easier to write the code I have also written an HP-34C program formatter in PHP. I only have to create an array, which is then automatically formatted into an orderly looking listing.


The HP-34C has some limitations when it comes to programming. They are not a secret, all is well documented in the manuals of the calculator. Nevertheless I want to repeat these limitations here, just for reference.

Program size

Memory is shared between program memory and data memory. Per default the memory is divided into 70 lines of programming steps and 20 normal storage registers (not counting the I register).
If the program grows beyond the 70 steps it will start reassigning normal memory into program memory, 7 program steps per memory location. The conversion starts at the highest data register (.9), and works its way down as needed to data register 0, at which point you'll have 210 program steps with no normal storage registers left.


The calculator has 12 labels. They are numbered from 0 to 9 and A and B. Labels are looked up from the current location onwards, towards the end of the program. If the label isn't found, the searching will wrap around and continue from program step 1 until the current program location. If the label is still not found you'll see an Error 4.
This means that you can re-use the same label over and over again, as long as you are careful that the calculator will find the intended label first, every time.


The calculator has only 4 flags, named 0 to 3.

Subroutine nesting

The calculator has a 6 level subroutine return stack. Trying to nest your subroutines too deep will result in an Error 8".

Program Snippets

Pseudo random number generators.
Convert degrees Fahrenheit to degrees Celsius, or the other way around.
Calculate number of days between two dates, or the day of the week.
Convert frequency to wavelength, or wavelength to frequency.
Calculate Ri Of A Power Source.
LM317 calculator. Calculates output Voltage, R1 or R2.
RC time calculator. Calculates charge and discharge times for RC circuits.