(32Sii, 35S) Rounding Value to nearest value in E24 Serie
|
02-14-2022, 09:16 PM
(This post was last modified: 02-15-2022 10:10 AM by jolatomme.)
Post: #1
|
|||
|
|||
(32Sii, 35S) Rounding Value to nearest value in E24 Serie
Hi, I am new to this forum but would like to share a small program that I frequently use and might be usefull.
Series are used in electronics to have a logarithmically based sequence and this enables the different values to be spaced in such a way that they relate to the component tolerance or accuracy. Since not every value are available, the goal of this program is to calculate the nearest value in the E24 normalized serie. This program works in RPN mode and is mainly based on stack manipulation. To discriminate between choices (program branches), flag mechnism has been preferred over LABEL and GOTO to save limited labels availability (HP32Sii). Given a value in X register (let's call it R), the first step of the program is to calculate the value exponent. This is done through steps 6 to 7 : LOG(IP(R)). Exponent is named D in the stack detail for simplicity The second step consist in finding the place in serie ROUND(LOG((R/10^D)^24), 0). Serie place is named M in the stack detail Once the place is found, E24 serie values will require an OFFSET correction: - if M = 22 : the offset will be -0.1 - if M≥10 and M≤16 the offset will be +0.1 - Offset = 0 for other place The third step consist in calculating the final value from serie's place and exponent : 10^D * ROUND(OFFSET + 24*SQRT(10^M), 1) Testing the serie's place is done in the program from instruction R19 to R29. Flags 0 and 1 are used to identify the offset correction. Final value calculation starts at step R30, offset decision is done from R34 to R40. R45 revert the calculator in 5 digit display (engineering format), but one may modify this step at convenience. Keep in mind that program checksum is calculated with ENG 5. Original value is availbale in Y,Z,T registers while final value is available in X register. On HP35S both values are displayed on the two lines screen while on HP32Sii X and Y register exchange key (X<>Y) needs to be pressed to visualize X and Y registers. Having both values in X and Y registers still allows further calculations like %chg or more ... A PDF reader friendly version is joined to the thread. Have fun. Code:
|
|||
02-17-2022, 06:55 PM
Post: #2
|
|||
|
|||
RE: (32Sii, 35S) Rounding Value to nearest value in E24 Serie
Hi,
48 and 96 series support can be added to this program. I mainly use E24 for my daily usage but if someone feels the need to add 48 and 96 serie support, I do not mind posting a second version of this program. Regards, Jo. |
|||
02-18-2022, 05:38 PM
Post: #3
|
|||
|
|||
RE: (32Sii, 35S) Rounding Value to nearest value in E24 Serie
Here is a related thread with HP48 programs for all series of standard resistor values including E192:
https://www.hpmuseum.org/forum/thread-15631.html |
|||
02-18-2022, 11:40 PM
(This post was last modified: 03-05-2022 05:28 PM by jolatomme.)
Post: #4
|
|||
|
|||
RE: (32Sii, 35S) Rounding Value to nearest value in E24 Serie
Hi John,
Thanks for your reply and pointing this out. I did not noticed this. E48 / E96 are following the exact mathematic definition. This is not the case for E24 / E192 where you have to offset some of the values. So adding support of other series in the previous program is not very difficult. Regards, Jo. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)