Post Reply 
(41C) Conversion sur HP 41C
12-19-2021, 10:50 AM (This post was last modified: 12-30-2021 10:14 PM by C.Ret.)
Post: #2
RE: (41C) Conversion sur HP 41C (adding dB-W)
Bonjour à tous,

At first glance the tittle in french intrigue my curiosity. I then realize that the reference article is written in french.

I try the code on my HP-41C.
It is a bit long code and not so easy to use since units have to be key in without any misspelling. Secondly, it produce quite erroneous results; when we are successively converting a value through all the available units, we get back a really different value from the starting one.

One detail that disturb me is that this code display the results with units mixing engineer notation and sub-unit indication.
For exemple, a value of one volt is display " 1.00E+6 µV " and one picovolt " 1.00E-3 µV " where I would have preferred " 1.00 V " and " 1.00 pV " respectively or at least (for a shorter and easier code) " 1.00E0 V " and " 1.00E-9 V" respectively. I think it's more general for large range of data and easy to read enough since engineer notation only show multiple exponent of 3.
That's the aim on engineer notation having full unit ( E0 ), multiple of unit such as mega or kilo (resp. E6 or E3), or sub-multiple of unit such as expected milli, micro or pico (resp. E-3 , E-6 or E-9 ).

One other detail that had disturbed me is that dB, which are dimensionless value are also expressed in engineer notation. This is useless, one may always display dB = x.xxxE0 since there is no unit. Display as xxx.xx dB is much more appropriate.

A third problem is that, amplification relative to power is missing.

So I rewrite this code to include all the features I was expecting in such a converter.

First, conversion is easy to achieve, I use digit entry detection of the HP-41C (flag 22) to detect no data entry and conversion order.

The indication of units use direct USER Alpha label A through E. So the the user have to key-in a value (that set the Flag 22) and press one key of the first row to indicate the unit.
To convert to any unit, the user may press directly the corresponding label without any digit entry.
Easy multiple conversions to different units are possible.

The impedance have to be entered in OHMS before any conversion in register R00 or using XEQ 00 or XEQ "IMP" to display the value.

Label - Units ( display notation )
00 - OHMS ( engineer) Impedance value have to be key-in in ohms: 50 [XEQ[00]] set Z = 50 Ohms and store value in register R00.
"A" - WATT (engineer) Power entered in Watt; value store in register R01
"B" - dB-W (fixe) Power amplification relative to one Watt : 1 [ A ] [ B ] display 0.00 dB-W. Value store in register R02.
"C" - db-m (fixe) dB-m (decibel-milliwatts) is amplification relative to one milliwatt (mW): 1 [EEX] 3 [CHS] [ A ] [ C ] display 0.00 dB-M . value store in R03
"D" - db-µV (fixe) electric field strength relative to 1 microvolt per meter. The unit is often used to specify the signal strength of a television broadcast at a receiving site (the signal measured at the antenna output is reported in dBμV): 1 [EEX] 6 [CHS] [ E ] [ D ] display 0.00 dB-µV. value is store in register R04
"E" - VOLT (engineer) Electric potential in VOLT : 7.07 [ E ] set value to 7.07 V and display " 7.07E0 VOLT " . Value is store in register R05

Principe of operation:

The unit of the entered value is remained by setting a flag (respectively Flag 01, 02, 03, 04 and 05 for each above unit).
When pressing a unit label-key without digit entry, conversion is achieve by retrospectively testing each flag and executing the corresponding conversion sub-routines:
LBL 01: convert from V (Volt) to power (Watt) ; W := V²/Z
LBL 02: convert from power (W) to power amplification, dB-W := 10*LOG(W)
LBL 03: convert from dB-W to dB-m ; dBm := 30+dBW
LBL 04: convert from dB-m to dB-µV ; dBµV := dBm+10*LOG(Z)+90
LBL 05: convert from dB-µV to Volt ; V := 10^(dBµV/20)

The code is one hundred of instructions:

01 LBL "IMP" SF 27
03 LBL 00 STO 00 CF 11 "OHM" GTO 11 // ENTER impedance Z (Ohm) press XEQ 00
08 LBL "A" FC?C 22 XEQ 01 STO 01 SF 01 CF 11 "WATT" GTO 11 // ENTER or CONVERT to mW ( x.xxxEee Watt ) press USER - A
16 LBL "B" FC?C 22 XEQ 02 STO 02 SF 02 SF 11 "W" GTO 11 // ENTER or CONVERT to dB-W ( xxx.xx dB-W ) press USER - B
24 LBL "C" FC?C 22 XEQ 03 STO 03 SF 03 SF 11 "m" GTO 11 // ENTER or CONVERT to dB-m ( xxx.xx dB-m ) press USER - C
32 LBL "D" FC?C 22 XEQ 04 STO 04 SF 04 SF 11 "µV" GTO 11 // ENTER or CONVERT to dB-µ ( xxx.xx dB-µV ) press USER - D
40 LBL "E" FC?C 22 XEQ 05 STO 05 SF 05 CF 11 "VOLT" // ENTER or CONVERT to µV ( x.xxxEee VOLT ) press USER - E
47 LBL 11 ASTO Y CLA ENG 3 FS? 11 FIX 2 ARCL X "~ " FS? 11 "~dB-"
57 ARCL Y ENG 6 PROMPT RTN // Display ( x.xxxEee unit or xxx.xx dB-unit )

61 LBL 01 FC?C 05 XEQ 05 x^2 RCL 00 / RTN // Convert from V to W := V²/Z
68 LBL 02 FC?C 01 XEQ 01 LOG 10 * RTN // Convert from W to dBW := 10*LOG(W)
75 LBL 03 FC?C 02 XEQ 02 30 + RTN // Convert from dBW to dBm := 30+dBW
81 LBL 04 FC?C 03 XEQ 03 RCL 00 LOG 10 * + 90 + RTN // Convert from dBm to dBµV := dBm+10*LOG(Z)+90
92 LBL 05 FC?C 04 XEQ 04 20 / 6 - 10^X // Convert from dBµV to µV := 10^(dBµV/20)
100 END

The µ and m symbols may be entered on half-nutt HP-41C using a synthetic technique or simply being replaced by capital letters U and M on any other Hp-41.

Typical used:(edited)
50 XEQ [ALPHA]IMP[ALPHA]     "50.00E0 OHM  "    // Startup program and initiate impedance
.6 A                         "600.0E-3 WATT"    // Enter power value in main unit (W). Displayed 'E-3' exponent indicate sub-unit (mW)
B                            "-2.22 dB-W   "    // Press label without digits entry display converted value.
D                            "134.77 dB-µV "    // Amplifications have no unit (no 'E+00' displayed)  
C                            "27.78 dB-m  "    // Power Amplification - no unit  
E                            "5.477E0 VOLT "    // 'E0' indicate unit scale (true VOLT)
A                            "600.0E-3 WATT"    // back to initial value 600 mW 
[<-]                           600.0000  -03    // Actual value in stack's X and register R01 (ENG 6 format)
[FIX [ 9 ]]                      0.599999993    // FIX 9 reveal rounding cumulative errors (error unmasked)

Sometime, numerous successive conversions may produced a few accumulated rounding errors. Fortunately, the display format in alpha register is masking rounding error (main of the time).
Accuracy can be check by setting in FIX 9 display mode and observing the values in registers.

Thanks to all of you.

EDITED 30-dec-2021 22:36 UTC+1: see following messages
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
(41C) Conversion sur HP 41C - SlideRule - 07-02-2020, 11:51 AM
RE: (41C) Conversion sur HP 41C (adding dB-W) - C.Ret - 12-19-2021 10:50 AM
RE: (41C) Conversion sur HP 41C - C.Ret - 12-30-2021, 09:29 PM
RE: (41C) Conversion sur HP 41C - C.Ret - 12-31-2021, 07:22 PM
RE: (41C) Conversion sur HP 41C - C.Ret - 01-01-2022, 04:03 PM

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