Post Reply 
(11C) Pressure Units Conversion (ATM, PSI and PSF)
06-13-2018, 12:55 PM (This post was last modified: 06-13-2018 06:50 PM by Dieter.)
Post: #2
RE: (11C) Pressure Units Conversion (ATM, PSI and PSF)
(06-13-2018 08:53 AM)Gamo Wrote:  Program to convert three type of pressure units between any one of ATM, PSI and PSF.

That's a nice little program that can even do more than you said. ;-)
Here is the general idea:

Enter a number and press A, B or C to input the known pressure.
Enter zero and press A, B or C to output the converted unit.
The zero is automatically set after an input, so you can directly press the key for the target unit.

(06-13-2018 08:53 AM)Gamo Wrote:  Convert 1 ATM to PSI
1 [A] display 0.0000
[B] display 14.6959

Here you can continue and get all possible units – just enter zero:

0 [C] => 2116,2166 psf
0 [B] => 14,6959 psi
0 [A] => 1,0000 atm

(note: these results are obtained with the exact conversion factors, i.e. with 6894,757293 and 47,88025898 instead of the rounded values)

The idea is simple: all input is converted to a common unit, in this case it's Pascal:
1 atm = 101325 Pa
1 psi = 6894,757... Pa
1 psf = 47,88... Pa

The Pascal-value is stored in R0. From there it is divided by the respective factor to get the desired unit.

So you can use this program for conversions to and from other units as well. Just change the constants.

You can even select one of the units as the "common unit" to which all input is converted. This way one of the constants becomes 1. Here for instance one could do so by dividing all constants by 47,88... so that the common unit now is psf instead of Pascal. This way the constants become

LBL A: 2116,216624  (psf per atm)
LBL B: 144  (psf per psi)
LBL C: 1  (psf per psf)

Re. programming: The program can be much shorter as most of the commands following LBL A B and C are identical.

Here's a version that implements both the unit change as well as the shorter code:

Code:
LBL A
2116,216624
GTO 0
LBL B
144
GTO 0
LBL C
1
LBL 0
x
x=0?
GTO 1
STO 0
CLX
RTN
LBL 1
R↓     // not required, but keeps previous results on the stack
RCL 0
LastX
÷
RTN

Of course this gives the same results:

1 [A] => 0,0000
   [B] => 14,6959
0 [C] => 2116,2166

Check:

0 [B] => 14,6959
0 [A] => 1,0000

Likewise you use the same program for conversions between, say, kilometers, miles and feet. Simply change the three constants:

LBL A: 3280,839895  (feet per kilometer)
LBL B: 5280  (feet per mile)
LBL C: 1  (feet per foot)

Convert 1 mile to kilometers and feet:

1 [B] => 0,0000
   [A] => 1,6093
0 [C] => 5280,0000

So this is indeed a handy program that can be used for much more than just pressure conversions.

Dieter

Edit: corrected some units, hoping everything is OK now. ;-)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (11C) Pressure Units Conversion (ATM, PSI and PSF) - Dieter - 06-13-2018 12:55 PM



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