(48G/S) Closest Standard-Resistor Values
|
09-24-2020, 11:40 AM
Post: #1
|
|||
|
|||
(48G/S) Closest Standard-Resistor Values
An excerpt from Calculator program finds closest standard-resistor values, EDN (magazine), Francesc Casanellas, February 3, 2005, pg.86
" You can use a Hewlett-Packard HP-48or 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 … EDN050203DI3580—LISTINGS 1, 2, and 3 “Calculator program finds closest standard-resistor values,” EDN, Feb 3, 2005, pg 86 … BEST! SlideRule |
|||
09-24-2020, 01:18 PM
Post: #2
|
|||
|
|||
RE: (48G/S) Closest Standard-Resistor Values
This is a very useful program, and I wrote a more compact version several years ago which is for the 48G and later, because it uses DOLIST::
Code:
|
|||
09-25-2020, 12:23 AM
Post: #3
|
|||
|
|||
RE: (48G/S) Closest Standard-Resistor Values
I've done similar programs, with E48/96/E192 versions below.
Code:
|
|||
09-26-2020, 02:25 PM
(This post was last modified: 09-26-2020 02:28 PM by John Keith.)
Post: #4
|
|||
|
|||
RE: (48G/S) Closest Standard-Resistor Values
Those are great, thanks for posting them! The output of the programs are very nice.
The problem with all of these programs is the size of the lists of resistor values. The array from E192, the worst case, takes over 1800 bytes. The standard resistor values are based on the nth root of 10, where n is 24, 48, 96 or 192. Unfortunately the R24 values are somewhat arbitrary and several of them differ from the calculated values by + or - 0.1 Ohms. Luckily the R48 and R96 values are exact and we can save much of the memory required by the program by computing the lists directly. Here is a version of my program from above for the R96 values: Code:
The program for the R48 values is nearly the same, just substituting the number 48 for 96. The R192 values do have one value that is off by 0.01 Ohms- the calculated value of 9.2 is actually 9.19. The program is thus a bit longer and less elegant but not too bad: Code:
Since the format of the arrays in your programs differs from the list in the original program, there would be some additional complexity but probably well worth it for the saving of precious calculator memory. |
|||
09-27-2020, 02:43 PM
Post: #5
|
|||
|
|||
RE: (48G/S) Closest Standard-Resistor Values
It occurred to me that since the standard values are (mostly) exact for E48, E96 and E192 we can dispense with lists entirely. I have stolen some of David Bengston's code for the following programs because the method of the original program does not work well with the one exception for E192.
First the program for E96. The program for E48 is again the same except for replacing the number 96 with 48. Code:
For E192 we must add a check for the errant value but the program is otherwise the same: Code:
Both programs work with all RPL calculators from the HP-28C through the 50g. |
|||
09-27-2020, 08:50 PM
Post: #6
|
|||
|
|||
RE: (48G/S) Closest Standard-Resistor Values
Thanks! With the memory in a 50G being so (relatively) large, I wasn't too concerned about saving bits, unlike an equivalent program in a 41 or 42S. This was for sure a quick hack, but it's been useful over the years. Your improvements in size are nice though. This makes it possible to incorporate this into other programs I'm working on.
Dave |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)