(41C) Conversion sur HP 41C
01-01-2022, 04:03 PM (This post was last modified: 01-02-2022 08:43 AM by C.Ret.)
Post: #9
 C.Ret Member Posts: 215 Joined: Dec 2013
RE: (41C) Conversion sur HP 41C
(01-01-2022 07:54 AM)Ángel Martin Wrote:  see attached - standard RAW format used by V41.

Thanks a lot, I just download Warren Furlow's V41 software from Christoph Gießelink site and install it on my laptop.

I now have a way to make standard and useful *.raw files. I also discover an easy way for synthetic programming since the *.lod files of this software allow easy hexadecimal editing of any code for the Virtual 41 !

Playing with this new tool, I enhance a bit my last version of the converter correcting three main quirks :
1. Too many times, when the user enter a value and don't ask for a conversion, multiple flags are set that situation may drive to erroneous results. Now a sub-routine to clear all the flags is call after each new value entry.
2. When dB are close to zero, same bad rounding appears and disturbs the display which may cause misreading. Now a rounding instruction is inserted when displaying unit free values for dB. The rounding limit is set by a FIX 7 instruction just before a RND instruction. This allows to have a correct result displayed when converting 1 µV (displayed as " 1.000E-6 VOLT ") into " 0.00 dB-µV " ( wrong versions was showing " 4.00E-8 dB-µV " ).
3. A new short label F allows to directly enter impedance Z (in Ohm). It can be used to change impedance value (when the user have key-in any digit) or to display back the current value store in R00. This also clear the indicators flags. This again avoid same further erroneous conversions.
When IMPEDANCE? is prompted, the user have to key-in the value (in Ohm) and press R/S to continue.
Whenever no impedance is given at application start, the code will prompt the user when needed. Simply press R/S on prompts to continue the conversion.

Like the previous version after each conversion, R/S can be use to directly convert to the next unit. By repeating the process over all the units available, all registers from R01 up to R05 will be set with the correlated values.

Beware that at the start of the code, a CLRG instruction clear all registers ! Please fill free to remove this instruction or to add any more convenient instructions to clear only expected registers.

[attachment=10226]

Code:
001 LBL"IMP"  CF 00  SF 27  ENG 3  CLRG 006   LBL F   FC?C 22  XEQ 06  STO 00  XEQ 00  SF 00  "OHM"   GTO 11 014   LBL A   FC?C 22  XEQ 01  STO 01  XEQ 00  SF 01  "WATT"  XEQ 11 022   LBL B   FC?C 22  XEQ 02  STO 02  XEQ 00  SF 02  "W"     XEQ 10 030   LBL C   FC?C 22  XEQ 03  STO 03  XEQ 00  SF 03  "m"     XEQ 10 038   LBL D   FC?C 22  XEQ 04  STO 04  XEQ 00  SF 04  "µV"    XEQ 10 046   LBL E   FC?C 22  XEQ 05  STO 05  XEQ 00  SF 05  "VOLT"  XEQ 11  GTO A 055   LBL 00  CF 01  CF 02  CF 03  CF 04  CF 05  RTN 062   LBL 01  FC?C 05  XEQ 05  X^2  XEQ 06  /  RTN 069   LBL 02  FC?C 01  XEQ 01  LOG  10  *  RTN 076   LBL 03  FC?C 02  XEQ 02  30  +  RTN 082   LBL 04  FC?C 03  XEQ 03  XEQ 06  LOG  10  *  +  90  +  RTN 093   LBL 05  FC?C 04  XEQ 04  20  /  6  -  10^X  RTN 102   LBL 06  RCL 00  FS? 00  RTN 106           RDN  "IMPEDANCE?"  PROMPT  GTO F 110   LBL 10  FIX 7  RND  FIX 2 114   LBL 11  ASTO L  CLA  ARCL X  >" "  FS? 40  >"dB-" 121           ARCL L  ENG 3  PROMPT  CF 22 125 END

USAGE:
The following traces illustrate a typical use of this conversion code. These traces are printed in NORM mode, so that user's key-in is right tabulated and displayed results are left justified.

Here is the .raw file: