2023-11-03 HP41C

HP41C calculator
HP41C from 1980

Recently I bought an HP41C calculator at ebay. Its the same age as me ;-). I had been tinkering with RPN calculators on my Android phone, but of course I had to get a real one.

Its was the first calculator with alphanumeric display and it also was fully programmable too. Interestingly its also expandable using the 4 IO ports. You can add more memory, extra functions, e.g. statistical methods a.s.o., or even a printer.

I started to learn programming with those two little programs. The first one is used for calculating the aperture angle of a camera with given number of horizontal pixels, pizel size in µm and the focal lenght of the lens.

aperture angle of a lens with a given sensor

The aperture angle is calculated like this:

2 * atan (width in mm / (2 * focal length in mm))

So the code I came up looks like this


LBL OA
ALPHA FOCAL LENGTH in mm ALPHA
XEQ PROMPT
STO 01
ALPHA No of Pixel ALPHA
XEQ PROMPT
ALPHA um Pixel size ALPHA
XEQ PROMPT
1000
/
*
RCL 01
2
*
/
ATAN
2
*

I assigned it to the LN key in user mode: SHIFT ASN OA LN

hyperfocal distance

The second program is used to calculate the hyperfocal distance for a camera. In short its the "Distance beyond which all objects can be brought into an acceptable focus." (see the wikipedia article)

Its calculated like this:

d_h = f^2/(k*Z)+f

where

Everything from infinty to half the hyperfocal distance is acceptably sharp on the image sensor.

The code for this problem looks like this:


LBL HFD
ALPHA Focal Length ALPHA
XEQ PROMPT
STO 01
ALPHA F STOP ALPHA
XEQ PROMPT
STO 02
ALPHA Pixel SIZE in um ALPHA
XEQ PROMPT
STO 03
RCL 01
X^2
RCL 03
1000
/
RCL 02
*
/
RCL 01
+

I assigned it to the LOG key in user mode: SHIFT ASN HFD LOG