HP15c program: Generic unit conversion
f LBL A 001-42,21,11 // LBL A
RCL 0 002- 45 0
/ 003- 10
g RTN 004- 43 32
f LBL B 005-42,21,12 // LBL B
RCL 0 006- 45 0
* 007- 20
g RTN 008- 43 32
This program uses the following labels: LBL A (remember: A=divide), LBL B (remember: B=multiply)
mnemonic trick: you calculator has at the top the divide key and below the multiply key. A comes before B in the alphabet.
This program uses STO 0 to store the conversion constant.
Using the program
A lot of unit or currency conversion can be done simply by multiplying or
dividing with a conversion factor. This program uses a generic conversion
constant stored in register 0 (STO 0). It is a very simple but useful program
that I use frequently.
I start every program with a label. This way you can have a number
of programs in your 15c and you just select which one to run by pressing f LABELNAME (f A or f B in this case) or GSB LABELNAME (GSB A or GSB B in this case).
Let's assume you are working on the design of a printed circuit board
and you need to convert frequently between mm (millimeter) and mil (1/1000 of an inch).
The conversion factor from mil to mm is therefore: 0.0254 mm/mil
Store this factor in register 0: 0.0254 STO 0
To convert now 5mm into mil you type: 5 f A
The result should be 196.85mil
To convert now 100mil into mm you type: 100 f B
The result should be 2.54mm
© Guido Socher