Post Reply 
(48G/S) Closest Standard-Resistor Values
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:

\<< DUP MANT 96. 10. OVER XROOT SWAP x DUP 0. 4. ROLL 1. SEQ ^ -3. RND \-> r m L1
  \<< L1 1.
    \<< m >
    \>> DOLIST 1. POS DUP 'L1' SWAP GET m / SWAP 1. - 'L1' SWAP GET m / INV DUP2 < { DROP r * } { SWAP DROP r SWAP / } IFTE -3. RND
  \>>
\>>

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:

\<< DUP MANT 192. 10. OVER XROOT SWAP x DUP 0. 4. ROLL 1. SEQ ^ -3. RND 186. { 9.2 } REPL \-> r m L1
  \<< L1 1.
    \<< m >
    \>> DOLIST 1. POS DUP 'L1' SWAP GET m / SWAP 1. - 'L1' SWAP GET m / INV DUP2 < { DROP r * } { NIP r SWAP / } IFTE -3. RND
  \>>
\>>

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (48G/S) Closest Standard-Resistor Values - John Keith - 09-26-2020 02:25 PM



User(s) browsing this thread: 2 Guest(s)