Showing posts with label DM32. Show all posts
Showing posts with label DM32. Show all posts

Saturday, October 11, 2025

RPN Calculators: INPUT vs PROMPT

RPN Calculators: INPUT vs PROMPT


Later RPN keystroke programming calculators are able to display alphabetic messages and store to variables for alphabetic names.


HP 32S, HP 32SII, HP 33S, HP 35S, DM32

HP 41C (all variants), DM41X

HP 42S, DM42, DM42n, Free 42

Single letter variable names

Numeric-named variables only

Both numeric-named variables and alphabetic (and alphanumeric) variable names. Alphabetic and alphanumeric named variables are enclosed in quotes (alpha strings) well stored and recalled and take additional memory.

Can display messages by setting Flag 10 and using the equation feature to type messages

Can display messages and prompts

Can display messages and prompts


Two common ways to cue the user to enter values are the INPUT and PROMPT commands.


The INPUT Command: HP 32 and HP 42S (and Swiss Micros/emulator equivalents)


Note: The INPUT command is not available in the HP 41C’s command set.


General syntax: INPUT var


When an INPUT command is encountered, the screen will display [var]?= on the X stack.


Example:

INPUT R displays R? [previous value stored in R]


HP 32 Family: The variable is a single-letter name or the indirect variable i.

HP 42S Family: A custom alpha variable, a numeric-named variable (i.e. 00, 01, 02, etc.), indirect variables, or the stack levels X, Y, T, Z, or L (last argument).


The INPUT has the double benefit of storing whatever is entered into the variable asked for. INPUT will also show the previously stored value, so we can just accept it by pressing R/S to keep the old value.


Example: Volume of a Cone


HP 32 family

HP 42S family

V01 LBL V

V02 INPUT R

V03 INPUT H

V04 π

V05 RCL R

V06 x^2

V07 ×

V08 RCL H

V09 ×

V10 3

V11 ÷

V12 RTN


No quotes are needed for alphabetic variables.



00 {30-Byte Prgm }

01 LBL “VCONE1”

02 INPUT “R”

03 INPUT “H”

04 PI

05 RCL “R”

06 x↑2

07 ×

08 RCL “H”

09 ×

10 3

11 ÷

12 RTN


We could use variables 00 and 01 (for example) for radius and height, respectively, except the input command prompt will show “R00?” or “R01?” which may not be user-friendly.


The INPUT does not replace the contents of the alpha register.


If we want the alphanumeric/alphanumeric variables (“R”, “H”) to be erased, we could have inserted CLV “R” and CLV “H” at the end, but that will erase the value associated with them.



The PROMPT Command: HP 41C and HP 42S (and Swiss Micros/emulator equivalents)


Note: The PROMPT command is not available on the HP 32S family.


General Syntax:

alpha string”

PROMPT

STO var


The alpha string is displayed until something, usually a numeric value, is entered. Unlike the INPUT command, the PROMPT does not automatically store the entered value into a variable. Therefore, if you want to use the value for future use, a STO (store) command must be used following the prompt.


Let’s take our volume of the cone example again:


HP 41C family

HP 42S family

01 LBL “VCONE2”

02 ^T RADIUS?

03 PROMPT

04 STO 00

05 ^T HEIGHT?

06 PROMPT

07 STO 01

08 PI

09 RCL 00

10 X↗2

11 *

12 RCL 01

13 *

14 3

15 /

16 RTN



R00 = radius

R01 = volume

00 { 40-Byte Prgm }

01 LBL “VCONE2”

02 “RADIUS?”

03 PROMPT

04 STO 00

05 “HEIGHT?”

06 PROMPT

07 STO 01

08 PI

09 RCL 00

10 X↑2

11 ×

12 RCL 01

13 ×

14 3

15 ÷

16 RTN



R00 = radius

R01 = volume


With PROMPT, I like to use the numeric-named memory registers, but we can use alphabetic or alphanumeric registers as well.


HP 32SII/DM32: Simulating PROMPT with Flag 10


Even though the HP 32SII does not have a PROMPT command, we can kind of simulate it by using the equation message feature.


To set flag 10: [ |→ ] [ × ]* (FLAGS), { SF }. [ . ] [ 0 ]

To clear flag 10: [ |→ ] [ × ]* (FLAGS), { CF }. [ . ] [ 0 ]

We have to use the decimal point key in order to access flags beyond 9.

(*HP 35S: [ ←| ] [ ↑ ] (FLAGS))


HP 32SII/33S/35S/DM32


W01 LBL W

W02 SF 10

W03 “=RADIUS”

W04 STO R

W05 “=HEIGHT”

W06 STO H

W07 CF 10


W08 π

W09 RCL R

W10 x^2

W11 ×

W12 RCL H

W13 ×

W14 3

W15 ÷

W16 RTN


Turn message mode on

Enter as an equation =RADIUS

Enter radius and press [R/S]

Enter as an equation =HEIGHT

Enter height and press [R/S]

Turn message mode off, so equations can operate normally



Note: Equations are NOT on the original HP 32S.



I hope you find this helpful.


Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


The author does not use AI engines and never will.

Saturday, September 13, 2025

RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric)



The Stopping Sight Distance Formula – Derivation


The stopping sight distance (SSD) formula calculates the theoretical distance that a driver needs to see to react and stop to avoid colliding with a person or hazard safely.


The SSD is measured in meters (or in US units, feet). This blog entry will focus on the SI system (meters, kilograms, seconds).


The SSD is broken down into two parts:


SSD = d1 + d2


Part 1: d1: Reaction Distance


d1 = reaction distance = v * t

v = velocity of the vehicle

t = reaction time that the driver takes to hit their brakes. The ideal reaction time is 1 second (or less). However, if the driver is tired or is later in age, the reaction time will increase. Typically, the reaction time is assumed to be 2.5 seconds.


In calculating SSD, the velocity is entered in usually in km/hr. (kilometers per hour). We need to change this into m/s.


1 km / hr * 1,000 m / 1 km * 1 hr / 3,600 s = 1,000 / 3,600 m/s = 5 / 18 m/s


Note many publication rounds this conversion factor to 0.278.


Hence, the completed reaction distance portion is:


d1 = 5 / 18 * v * t



Part 2: d2: Stopping Distance


This part is more complicated and includes factors such as friction force (µ), weight of the car (mass/g, g = 9.80665 m/s^2), and grade of the road (grd%, which is the increase or decrease of the slope of the road).


A common formula for d2 is:

d2 = v^2 / (a * (µ + grd%))


Another way to determine d2 is to equate the kinetic energy of the car with the work required to stop the car:


KE = work

m * v^2 / 2 = (µ + grd%) * w * d2


where:

m = mass of the car, in kg

v = velocity of the car, in km/hr

µ = friction factor (unit-less)

d2 = distance in m

w = weight of the car in N

grd% = grade of the road, in decimal (i.e. 1% = 0.01) (unit-less)

g = 9.80665 m/s^2


Note that mass = weight / gravity acceleration; m = w / g:


w / g * v^2 / 2 = (µ + grd%) * w * d2


Solving for d2:


d2 = v^2 / (2 * g * µ) = v^2 / (2 * g) * 1 / (µ * grd%)



Note that d2 is in meters. But v is in km/hr. Once again, a conversion factor is required. I’m focusing on the portion v^2 / (2 * g). I’m going to break the problem down into two parts: numerator and denominator.


Numerator:


1 km^2 / hr^2 * 1^2 hr^2 / 3,600^2 s^2 * 1,000^2 m^2 / 1^2 km^2 = 25 / 324 m^2 / s^2


Denominator:


2 * g = 2 * 9.80665 m/s^2 = 19.6133 m/s^2


Numerator/Denominator:


(25 / 324 m^2/s^2) / 19.6133 m/s^2 ≈ 3.934090328 * 10^-3 m ≈ 1/254.188368 m


Publications and associations, such as the AASHTO (American Association of State Highway and Transportation Officials), will often round 254.188368 to 254.



The Completed Formula


SSD = d1 + d2 = d1 = 5/18 * v * t + v^2 / (254.188368 * (µ + grd%))


The value of µ usually takes the values between 0.3 and 0.4. For the program, I’m assuming that µ = 0.35 for wet road conditions and µ = 0.70 dry conditions



SSD in US Units


Using similar analysis, the SSD in US units is:


SSD = 22/15 * v * t + v^2 / (29.91388812 * (µ +grd%))


where: v = velocity in mi/hr (mph), t = reaction time in seconds, SSD in feet (ft)


Publications will round the constants to 1.47 and 30, respectively.


On obtaining the conversion factors, note that:

1 mi/hr = 22/15 ft/s

1 mi^2/hr^2 = 484/225 ft^2/s^2

2 * g = 2 * 9.80665 m/s^2 * 100/30.48 ft/s^2 ≈ 2 * 32.17404856 ft/s^2 ≈ 64.34809711 ft/s^2

(484/225) / (64.38409711) ≈ 0.033429288 ≈ 1/29.91388812



DM32/ HP 32II Program: Stopping Sight Distance (SI Units)

(not for the HP 32S because it uses messages)


D01 LBL D

D02 35 [store constants; wet conditions times 100]

D03 STO A

D04 70 [store constants; dry conditions times 100]

D05 STO B

D06 2.5 [store default reaction time]

D07 STO T

D08 INPUT T

D09 INPUT V

D10 INPUT G [enter grade as a percentage: 1% → 1]

D11 SF 10 [set message mode, SF, decimal point, 0]

D12 “1 WET 2 DRY”

D13 INPUT i [input indirect variable]

D14 CF 10 [turn off message mode, CF, decimal point, 0]

D15 RCL V

D16 x^2

D17 RCL (i)

D18 RCL+ G

D19 100

D20 ÷

D21 254.188368

D22 ×

D23 ÷

D24 5

D25 RCL× V

D26 RCL× T

D27 18

D28 ÷

D29 +

D30 STO D [store and view SSD]

D31 VIEW D

D32 RTN


HP 42S/DM42/Free 42 Program: Stopping Sight Distance (SI Units)

(This program is similar to the 32SII version.)


00 {121-Byte Program}

01 LBL “SSD”

02 35

03 STO 01

04 70

05 STO 02

06 2.5

07 STO 03

08 “REACT TIME?”

09 PROMPT

10 STO 03

11 RCL 04

12 “VELOCITY?”

13 PROMPT

14 STO 04

15 RCL 05

16 “GRADE?”

17 PROMPT

18 STO 05

19 RCL 00

20 “1. WET 2. DRY”

21 PROMPT

22 STO 00

23 RCL 04

24 X↑2

25 RCL IND 00

26 RCL+ 05

27 100

28 ÷

29 254.188368

30 ×

31 ÷

32 5

33 RCL× 03

34 RCL× 04

35 18

36 ÷

37 +

38 STO 06

39 “SSD=”

40 ARCL ST X

41 RTN



Variables:

R00 = choice variable

R01 = wet condition friction coefficient * 100

R02 = dry condition friction coefficient * 100

R03 = reaction distance (set to default as of 2.5 sec)

R04 = velocity (km/hr)

R05 = grade

R06 = SSD in meters


Examples


Velocity: 96.5606 km/hr (about 60 mi/hr), Time: 2.5 seconds, Grade: 0%

Dry Conditions (i = 2): SSD: 119.4578 m

Wet Conditions (i = 1, µ = 0.35), SSD: 171.8596 m


Velocity: 96.5606 km/hr, Time: 1.5 seconds, Dry Road

Grade: +1%: SSD: 91.8973 m

Grade: -1%: SSD: 93.3948 m



Sources


American Association of State Highway and Transportation Officials NCHRP Report 400. 1997. Last accessed April 27, 2025. https://onlinepubs.trb.org/onlinepubs/nchrp/nchrp_rpt_400.pdf


Chandra, Satish IITR “Stopping Sight Distance on a road. Definition, concept, and evaluation of SSD with examples.” YouTube Video. July 16, 2023. https://www.youtube.com/watch?v=HEzdJE7NQeU&t=973s Last accessed April 27, 2025.


Omni Calculator. “Stopping Distance Calculator” July 22, 2024. Last accessed April 26, 2025. https://www.omnicalculator.com/physics/stopping-distance



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

The author does not use AI engines and never will.

Saturday, August 16, 2025

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations



Introduction


We know calculators that have base conversions easily convert integers to different bases. But what about all real numbers? Not so much. Today’s blog will tackle it.


The procedure given today should work for converting from decimal to octal, binary, and hexadecimal. I chose hexadecimal:


0.A B C D… _16

The digit A is in units of 1/16.

The digit B is in units of 1/16^2 or 1/256.

The digit C is in units of 1/16^3 or 1/4096.

The digit D is in units of 1/16^2 or 1/65536.

and so on.


Note: The procedure considers positive real numbers only.


Example: Convert 7.86 to hexadecimal using 4 places


In hexadecimal, 4 places translates to terms of 1/65536.


Separate 7.86 into its integer and fractional parts.

Integer Part: 7

Fractional Part: 0.86

Convert the fractional part to n parts of 65536. (16^4)*

0.86 * 65536 = 56360.96

Round n to the nearest integer. Use the formula: int(n + 0.5) = int(n + 1/2)

Int(56360.96 + 0.5) = 53361

(round(56360.96, 0) = 53361)

Convert both original integer part and the last result to hexadecimal.

Integer Part: 7_10 → 7_16

Frac in terms of 65536: 53361_10 → DC29_16

**If the fractional part has less than four* digits showing in the calculator, pad the converted part with zeros on the left.


The approximate answer reads as:

7.86_10 → 7.DC29_16

Recall in Hexadecimal:

A=10, B=11, C=12, D=13, E=14, F=15.


* precision: number of places.


HP 32S/HP 32SII/DM32 Code


H01 LBL H

H02 ENTER

H03 IP

H04 x<>y

H05 FP

H06 16

H07 4 (** - accuracy level, number of places)

H08 y^x

H09 ×

H10 2

H11 1/x

H12 +

H13 IP

H14 HEX

H15 STOP

H16 DEC

H17 RTN



HP 42S/DM42 Code


01 LBL “→HEX”

02 ENTER

03 IP

04 x<>y

05 FP

06 16

07 4 (** - accuracy level, number of places)

08 Y↑X

09 ×

10 0.5

11 +

12 IP

13 HEXM

14 STOP

15 EXITALL

16 RTN



When the program stops initially, the results are shown as follows:

Y: integer part

X: fractional part – right justified


Remember the number of places (precision) because if the fractional part has less digits, pad zeroes to the left.


Examples


n = precision = 4

Decimal

Y: Hex Integer

X: Hex Fractional (displayed)

Result (base 16)

3.5

3

8000

3.8000

π

3

243F

3.243F

√2

1

6A0A

1.6A0A

0.6732

0

AC57

0.AC57

0.0002

0

D

0.000D

e^4.1

3C

571D

3C.571D

8.2^1.7

23

C460

23.C460



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


All posts are 100% generated by human effort.  The author does not use AI engines and never will.


TI-84 Plus CE: Logistic Map

TI-84 Plus CE: Logistic Map It feels like forever since I with the TI-84 Plus CE. Introduction The program LOGISTIC plots ...