|
|
|
|
My HP-67 magnetic card programmable calculator, manufactured in 1978.
|
Resistor Network Solver for the HP-67 Programmable Calculator
I acquired my HP-67 at the beginning of 2008, and it sat on the shelf until
November when I finally found the time to rebuild the battery pack and overhaul
the card reader. I then set out to enter a program I'd written for the HP-67
earlier in the year (and debugged on an HP-41C, after hand-translating it).
I wrote this program because I often need to determine voltages at the nodes of
simple resistor networks (for example, while designing my
USB Powered AA Battery Charger).
This program can find node voltages in networks of one or two nodes, with up
to five resistors and/or constant current sources per node. The following
is an example of such a network:
|
|
A simple network with one node, two resistors, two voltage sources, and a current source.
|
The program uses Kirchoff's Current Law together with Ohm's Law to compute the
voltage at the node(s). Kirchoff's law states that the sum of all the currents
flowing into a node must equal zero. In other words, for every Amp of current
that flows in, an Amp of current must flow out. Ohm's Law states that the
current flowing through a resistor equals the voltage across the resistor
divided by the resistance.
For the single node case, finding the node voltage for a network with
N resistors and M current sources is a matter of solving
the following equation for Vnode:
Fortunately, the solution is rather simple, and is well suited to being
computed by a programmable calculator such as the HP-67:
Solving a problem with two nodes is an iterative process of alternately solving
two problems with one node each. First we solve the problem for one of the
nodes, treating the the other node as a voltage source and guessing its voltage
(any reasonable guess will do). This gives an estimate of the voltage of the
first node. We can then solve the second node the same way, treating the first
node as a voltage source having the voltage we just estimated, and giving an
estimate for the voltage of the second node. Now we can go back and solve the
first node again and we'll get a better estimate of its voltage. We can
continue like this, going back and forth, getting ever closer estimates of the
node voltages. When the estimates stop changing at the level of precision we
need, we're done.
Using the Program
First type in the program and save it, or read it from a previously recorded
magnetic card. The card should be labelled as follows:
|
RESISTOR NETWORKS OF 1 OR 2 NODES
|
|
|
DROP
|
1↔2
|
CLEAR
|
i→Ii
|
i→Pi
|
|
|
Vi,Ri
|
Ii
|
→Vnode
|
→I1,I2,...
|
→P1,P2,...
|
Single Node Problems
Consider a single node network consisting of two resistors and a constant
current source as shown:
Solve the problem using the following steps:
| Description | Keystrokes | Display |
h ENG DSP 2 | 0.00 00 |
| f c | 0.00 00 |
5 ENTER 56 EEX 3 A | 1.00 00 |
0.3 ENTER 27 EEX 3 A | 2.00 00 |
0.1 EEX 3 CHS B | 3.00 00 |
| C | 3.65 00 |
| D | 24.1 -06 |
| R/S | -124. -06 |
| R/S | 100. -06 |
| E | 32.5 -06 |
| R/S | 416. -06 |
| R/S | 0.00 00 |
2 f d | -124. -06 |
2 f e | 416. -06 |
Notice that the computed value of I2 is negative, meaning
that current if flowing out of the node through R2.
Since I3 was entered as a fixed current as opposed to a
voltage or resistor, computing I3 just returns the
entered value, and computing P3 returns zero.
If you make a mistake when entering an input to a node (a voltage/resistance
pair or a current), you can remove the most recently entered input using the
DROP command (press f a).
Two Node Problems
Consider the following two node network:
Each node has four connections. The leftmost node
(Vnode1) is connected by resistors
R1ab, R2a,
R3a, and R4a to voltages
Vnode2, V2a,
V3a, and ground respectively.
The rightmost node also has four connections, three resistors and a constant
current input of 0.1mA. The resistors R1ab,
R2b, and R3b connect to voltages
Vnode1, V2b,
V3b respectively.
To solve this problem, first consider the leftmost node in isolation, and
partially solve it using the following steps:
| Description | Keystrokes | Display |
| f c | 0.00 00 |
0 ENTER 68 EEX 3 A | 1.00 00 |
5 ENTER 56 EEX 3 A | 2.00 00 |
0.3 ENTER 27 EEX 3 A | 3.00 00 |
0 ENTER 47 EEX 3 A | 4.00 00 |
| C | 1.10 00 |
Now solve the rightmost node, using the estimated voltage of the left node:
| Description | Keystrokes | Display |
| f b | 1.00 00 |
6 ENTER 33 EEX 3 A | 2.00 00 |
3 ENTER 22 EEX 3 A | 3.00 00 |
0.1 EEX 3 CHS B | 4.00 00 |
| C | 4.80 00 |
Finally, alternate between the two nodes, recomputing
Vnode until the values stop changing:
| Description | Keystrokes | Display |
| f b | 4.00 00 |
| C | 1.88 00 |
| f b | 4.00 00 |
| C | 4.93 00 |
| f b | 4.00 00 |
| C | 1.90 00 |
| f b | 4.00 00 |
| C | 4.93 00 |
| f b | 4.00 00 |
| C | 1.90 00 |
The two Vnode values stop changing when
Vnode1 = 1.90V and Vnode2 = 4.93V,
so that is the final solution.
Just as with the single-node solution, you can view and review the currents and
power dissipation through each resistor connected to the currently selected
node.
Program Listing
| Line | Instruction | Comments |
| 001♦ | LBL a |
| 002 | RC I |
| 003 | 2 |
| 004 | x>y? |
| 005 | RTN |
| 006 | − |
| 007 | ST I |
| 008 | SF 1 |
| 009 | GTO 1 |
| 010♦ | LBL B |
| 011 | 0 |
| 012♦ | LBL A |
| 013 | RC I |
| 014 | 2 |
| 015 | 0 |
| 016 | − |
| 017 | x=0? |
| 018 | 1/x |
| 019 | R↓ |
| 020 | x↔y |
| 021 | STO (i) |
| 022 | ISZ I |
| 023 | x↔y |
| 024 | STO (i) |
| 025 | ISZ I |
| 026 | SF 1 |
| 027♦ | LBL 1 |
| 028 | RC I |
| 029 | 2 |
| 030 | ÷ |
| 031 | RTN |
| 032♦ | LBL C |
| 033 | F? 1 |
| 034 | GTO 5 |
| 035♦ | LBL 3 |
| 036 | RCL B |
| 037 | RCL C |
| 038 | ÷ |
| 039 | STO D |
| 040 | CF 1 |
| 041 | RTN |
| 042♦ | LBL 5 |
| 043 | RC I |
| 044 | STO A |
| 045 | CLx |
| 046 | STO B |
| 047 | STO C |
| 048 | ST I |
| 049♦ | LBL 2 |
| 050 | RC I |
| 051 | RCL A |
| 052 | x=y? |
| 053 | GTO 3 |
| 054 | RCL (i) |
| 055 | ISZ I |
| 056 | RCL (i) |
| 057 | ISZ I |
| 058 | x≠0? |
| 059 | GTO 4 |
| 060 | R↓ |
| 061 | RCL B |
| 062 | + |
| 063 | STO B |
| 064 | GTO 2 |
| 065♦ | LBL 4 |
| 066 | ENTER |
| 067 | 1/x |
| 068 | RCL C |
| 069 | + |
| 070 | STO C |
| 071 | R↓ |
| 072 | ÷ |
| 073 | RCL B |
| 074 | + |
| 075 | STO B |
| 076 | GTO 2 |
| 077♦ | LBL D |
| 078 | SF 0 |
| 079 | CLx |
| 080 | STO E |
| 081 | GTO 0 |
| 082♦ | LBL E |
| 083 | CF 0 |
| 084 | CLx |
| 085 | STO E |
| 086 | LBL 0 |
| 087 | RCL E |
| 088 | RC I |
| 089 | x=y? |
| 090 | GTO 1 |
| 091 | F? 0 |
| 092 | SF 2 |
| 093 | GSB 8 |
| 094 | R/S |
| 095 | RCL E |
| 096 | 2 |
| 097 | + |
| 098 | STO E |
| 099 | GTO 0 |
| 100♦ | LBL d |
| 101 | SF 2 |
| 102♦ | LBL e |
| 103 | 1 |
| 104 | − |
| 105 | 2 |
| 106 | × |
| 107 | STO E |
| 108♦ | LBL 8 |
| 109 | F? 1 |
| 110 | GSB 5 |
| 111 | RCL E |
| 112 | x↔I |
| 113 | STO A |
| 114 | RCL (i) |
| 115 | ISZ I |
| 116 | RCL (i) |
| 117 | x=0? |
| 118 | GTO 6 |
| 119 | x↔y |
| 120 | RCL D |
| 121 | 0 |
| 122 | + |
| 123 | − |
| 124 | x↔y |
| 125 | ÷ |
| 126 | GTO 7 |
| 127♦ | LBL 6 |
| 128 | x↔y |
| 129♦ | LBL 7 |
| 130 | RCL A |
| 131 | ST I |
| 132 | R↓ |
| 133 | F? 2 |
| 134 | RTN |
| 135 | x2 |
| 136 | × |
| 137 | RTN |
| 138♦ | LBL c |
| 139 | CLREG |
| 140 | P↔S |
| 141 | CLREG |
| 142 | GTO 1 |
| 143♦ | LBL b |
| 144 | 9 |
| 145 | RC I |
| 146 | − |
| 147 | x<0? |
| 148 | √x |
| 149 | RC I |
| 150 | STO 0 |
| 151 | RCL 1 |
| 152 | P↔S |
| 153 | STO 1 |
| 154 | 2 |
| 155 | RCL 0 |
| 156 | x=0? |
| 157 | + |
| 158 | ST I |
| 159 | RCL D |
| 160 | STO 0 |
| 161 | SF 1 |
| 162 | GTO 1 |
An interesting feature of this program is that it takes advantages of the
HP-67's primary and secondary register sets when solving problems with two
nodes. Most of the work of switching from one node to the other is done by
a P↔S instruction (additional instructions are used to keep
R1 consistent between the two nodes, and to save the number of inputs of the
inactive node in its V1 register).
Registers and Flags
| Register | Use |
| 0, 2, 4, ..., 18 |
| 1, 3, 5, ..., 19 |
| A |
| B |
| C |
| D |
| E |
Revision History
2008-Nov-18 — Initial release.
Possible Improvements
The process for solving a network with two nodes is a bit tedious, because the
user must manually switch back and forth between the two nodes (by pressing
f b) and compute the node voltage (by pressing C). It
is up to the user to decide when the solution has stabilized. This sort of
thing is easy for a programmable calculator to do, but the program uses all the
calculator's memory registers already, so none are left to perform the
necessary book-keeping to automatically control such an iteration. Hopefully,
I'll think of some clever "trick" to get around this problem. If any one
reading this has a suggestion, please leave a comment below.
Other HP Calculator Programs
I've written programs for many of the HP calculators calculators in my
collection. You may be interested in some of these:
- HP 35s
- HP-41C/CV/CX
- HP-67
|
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.
Copyright:
All materials on this web site, including the text, images, and HTML
mark-up, are Copyright © 2009 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.
|
|