Post Reply 
(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:

R001    LBL R
R002    ENTER
R003    ENTER
R004    CF0
R005    CF1
R006    LOG
R007    IP
R008    10^x
R009    ENTER
R010    1/x
R011    R↑ (or REGZ)
R012    x (multiplication)
R013    24
R014    y^x
R015    LOG
R016    FIX 0
R017    RND
R018    ENTER
R019    22
R020    x=y?
R021    SF 0
R022    CLx
R023    16
R024    x<y?
R025    SF 1
R026    CLx
R027    10
R028    x>y?
R029    SF 1
R030    R↓
R031    10x
R032    24
R033    x√y
R034    0.1
R035    FS? 0
R036    CF 1
R037    FS? 1
R038    CLx
R039    FS? 0
R040     +/-
R041     +
R042    FIX 1
R043    RND
R044    x (multiplication)
R045    ENG 5
R046    RTN


Attached File(s)
.pdf  E24.pdf (Size: 60.61 KB / Downloads: 12)
Find all posts by this user
Quote this message in a reply
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.
Find all posts by this user
Quote this message in a reply
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
Find all posts by this user
Quote this message in a reply
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




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