(48) Closest Standard-Resistor Values
|
06-24-2019, 04:52 PM
Post: #1
|
|||
|
|||
(48) Closest Standard-Resistor Values
An extract from “Calculator program finds closest standard-resistor values,” EDN magazine, Feb 3, 2005, pg 86.
… You can use a Hewlett-Packard HP-48 or HP-49 calculator and one of the following programs written in RPN (Reverse-Polish Notation) to compute the nearest standard value that’s closest to a required value.You enter a required resistor value, and the program returns the closest higher or lower value in the selected series … … Listing 1: Convert a resistor value into the nearest value of the R24 series. « ? r « r MANT ? m « {1. 1.1 1.2 1.3 1.5 1.6 1.8 2. 2.2 2.4 2.7 3. 3.3 3.6 3.9 4.3 4.7 5.1 5.6 6.2 6.8 7.5 8.2 9.1 10. } ‘L1’ ST0 0 DO 1 + DUP ‘L1’ SWAP GET UNTIL m > END DUP ‘L1’ SWAP GET m / ? b « 1 – ‘L1’ SWAP GET m / INV ? a « a b IF = THEN r b * ELSE r a / END -2 RND » » » » ‘L1’ PURGE » *** Listing 2: Convert a resistor value into the nearest value of the R48 series « ‘10^(1/48)’ ? r n ‘n^IP(LN(x*vn/LN(n))’ EVAL –3 RND » *** Listing 3: Convert a resistor value into the nearest value of the R96 series. « ‘10^(1/96)’ ? r n ‘n^IP(LN(x*vn/LN(n))’ EVAL –3 RND » BEST! SlideRule |
|||
06-26-2019, 11:00 PM
Post: #2
|
|||
|
|||
RE: (48) Closest Standard-Resistor Values
I saw that article years ago and thought the programs were very useful. I did not think that highly of the programming style of Listing 1 however and I took the liberty of rewriting it. I will now take the further liberty of posting my revision here. For HP-48G and later.
Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)