Engineering format

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
chengjm
Posts: 3
Joined: Sat Apr 28, 2018 2:51 pm
Location: Singapore

Engineering format

Post by chengjm » Thu May 17, 2018 7:49 am

Hi,
I wrote this program for my own use when working on electronic designs (e.g. to get the right values of capacitor in pF or uF). It imitates the function ←ENG and ENG→ as in HP35S and most other ALG scientific calculators. This is just a simple program, and for most people who don't need this function, it is actually quite useless! A simple explanation follows.

This HP42S program performs the ←ENG and ENG→ similar to HP35S.
It uses the "round" program which computes the nearest integer to X.
Example usage of "ENG←→", enter 4.58E-12, XEQ "ENG←→",
Z: 4.5800E-12
Y: -12.0000
X: 4.5800

where:
X=mantissa
Y=exponent
Z=original number.

Press the menu keys ←ENG or ENG→ to shift the exponent. Press Done! to end the program.
After pressing ENG→ once, we have:
Z: 4.5800E-12
Y: -9.0000
X: 0.0046

Press ←ENG twice, we have:
Z: 4.5800E-12
Y: -15.0000
X: 4,580.0000

The "ENG←→" program is here:

Code: Select all

00 { 134-Byte Prgm }
01▸LBL "ENG←→"
02 STO "x"
03 CF 00
04 X<0?
05 SF 00
06 ABS
07 LOG
08 ENTER
09 IP
10 STO "p"
11 -
12 STO "s"
13 RCL "p"
14 3
15 ÷
16 XEQ "round"
17 3
18 ×
19 STO "N"
20▸LBL 00
21 RCL- "p"
22 +/-
23 RCL+ "s"
24 STO "s"
25 RCL "x"
26 RCL "N"
27 STO "p"
28 RCL "s"
29 10↑X
30 FS? 00
31 +/-
32 CLMENU
33 "←ENG"
34 KEY 1 GTO 01
35 "ENG→"
36 KEY 2 GTO 02
37 "Done!"
38 KEY 6 GTO 06
39 MENU
40▸LBL 10
41 STOP
42 GTO 10
43▸LBL 01
44 -3
45▸LBL 11
46 RCL+ "p"
47 STO "N"
48 GTO 00
49▸LBL 02
50 3
51 GTO 11
52▸LBL 06
53 RCL "x"
54 EXITALL
55 END
The "round" routine is:

Code: Select all

00 { 19-Byte Prgm }
01▸LBL "round"
02 ENTER
03 IP
04 STO ST Z
05 -
06 2
07 ×
08 IP
09 +
10 END
JM.
Attachments
ENG.zip
(3.17 KiB) Downloaded 33 times

Post Reply