Converting hp42s programs



#2

I have 42s programs on paper and they pertain to oilfield drilling programs. I have a new 49g+ and want to get these programs on it... how do I get them converted. They are not that large, but I have no experiance in programming.


#3

Unfortunately, the only way I'm aware of to do that is to translate the programs from HP-42S RPN to RPL, which means you have to know how to program in both languages. For earlier calculators, 48G and 49G, there is Hrastprogrammer's HP42X emulator of the HP-42S. But he doesn't have a version for the 49G+, according to the referenced site.

Regards,
Howard


#4

Is there anyone out there that can program in RPN & RPL that would be interested in helping me create these new programs forthe 49G+ I do not have that many programs and they are not that large.

Any help would be great!
Here is an example:
01 LBL "PUMP"
02 INPUT "LINER"
03 INPUT INPUT "STK LNT"
04 INPUT "EFF"
05 INPUT "SPM"
06 RCL "LINER"
07 X^2
08 0.000243
09 X
10 RCL "STH LNT"
11 X
12 RCL "EFF"
13 X
14 0.01
15 X
16 STO "BBL/STK"
17 VIEW "BBL/STK"
18 42
19 X
20 STO "GAL/STK"
21 VIEW "GAL/STK"
22 RCL "SPM"
23 X
24 STO "GAL/MIN"
25 VIEW "GAL/MIN"
26 INPUT "GAL/MIN"
27 RCL "GAL/STK"
28 /
29 VIEW "SPM"
30 END


Edited: 16 Jan 2006, 7:14 p.m.


#5

Are these programs freely redistributable?

03 INPUT INPUT "STK LNT"

I assume that should be:

03 INPUT "STK LNT"

Regards,
Howard

#6

You also have some useless "VIEW" statements there. Those won't cause the program to stop, so they'll just get overwritten by subsequent "VIEW" statements. Only the last one will show.

Did you want to do a 42S-style "variable menu" where each parameter is entered, and/or viewed via a softkey?


#7

Hi, Howard;

just a reminder: if the printer is active (IR output), these values will be printed. Otherwise, as it happens with the HP41, by manipulating flag 21 you can have the program halted in each VIEW/AVIEW. d8^)

Also, it seems to me it was taken from an original HP41 FOCAL listing, by subtituting numeric STO/RCL and related PROMPT/VIEW for newer ALPHA variables. The program style is a hint, don't you agree?

Cheers.

Luiz (Brazil)

Edited: 16 Jan 2006, 10:33 p.m.

#8

Hi, B Douglas;

please allow me some comments/questions.

First: would that be possible to add an example on how to use the program? I'm asking this because of the following: (consider this an anlysis of the program lines)

lines #2 to #5 ask for LINEAR, STK LNT (STacK LeNghT?), EFF (efficiency?) and SPM (?);

lines #6 to #16 compute:

BBL/STK = (LINEAR)2×2.34-4×(STK LNT)×(EFF)×.01
If so, considering EFF×.01 only converts percent efficiency to absolute per unit value, we may save some bytes and writte:
BBL/STK = (LINEAR)2×2.34-6×(STK LNT)×(EFF)
At this point, BBL/STK is stored and shown (line #17). Then lines #18 to #21 compute and show:
GAL/STK = BBL/STK × 42
and lines #22 to #25 compute and show:
GAL/MIN = (SPM) × (GAL/STK)
Line #27 halts program execution, shows current GAL/MIN and prompts for new value, if current value is not 'good enough'. Whether a new value is keyed in or the current one is kept, pressing [R/S] at this point leads to compute:
(? value) = current (GAL/MIN) ÷ (GAL/STK)
Although this new value is left in the X-register and in the lower line of the LCD, the upper line shows current (SPM) value.

I'd like to know if this is actually what the program does and if you have a single example to test both the one that's keyed in and a possible RPL equivalent.

Cheers.

Luiz (Brazil)


Edited: 16 Jan 2006, 10:39 p.m.


#9

Here is an example:

LINER = 5.5
STK LNT = 10
EFF. = .95
SPM = 90

This is for computing gallons per min(GPM):

Your inputs are as Follows: you state what your "liner" size is of the hole(5.5).

then your "STK LNT" stroke length of your pumps (10).

then your "EFF", stands for pump efficiency. ...one can enter (.95) and you would not have to multple by .01 to change 95 into .95)

then the calc asks for what "SPM" your thinking of running (strokes per min).


then the program takes your "liner" and Squares it. 5.5^2=30.25

then multiplies it by (.000243)=.00735075

then takes that and multplies it by your "STK LNT" & "EFF" = .69832125

It stores that number and gives it to you as "BBL/STK" (BBL/STK is .6982125)

Then it takes your "BBL/STK" and multiplies that by 42 = 2.93294925 or 2.93

It stores that number and gives it to you as "GAL/STK" (GAL/STK is 2.93)

then it takes your "SPM" your would like to run and multiplyes that by your "GAL/STK" = 263.96 or 263 GPM

It give you the answer as (Total GPM is 263)

If you need more examples they can be provided


#10

Your listing does more than that. At line 26, it prompts for a new Gal/Minute and calculates a new Strokes/Minute, displaying it along with the old Strokes/Minute.

Ignoring that, the following program comes up with similar answers on a 49G+:

\<<
"Enter Liner" ">" INPUT OBJ\->
"Enter Stroke Length" ">" INPUT OBJ\->
"Enter Efficiency" ">" INPUT OBJ\->
"Enter Strokes/Minute" ">" INPUT OBJ\->
\-> lin stl eff spm
\<<
lin SQ .000243 * stl * eff * .01 *
DUP "Bbl/Stroke = " SWAP + SWAP
42 *
\-> 'gps'
\<<
"Gal/Stroke = " gps +
"Gal/Minute ="
gps spm * +
6 DISP
5 DISP
4 DISP
"Press a key to exit"
9 DISP
0 WAIT DROP
\>>
\>>
\>>

I've probably missed a trick or two. If so, you can be sure Luiz will catch it. 8)


Edited: 17 Jan 2006, 1:15 a.m.


#11

HOW DO I ENTER THIS INTO THE CALC....I KEEP GETTING SYNTAX ERRORS.
I HAVE NO EXPERIENCE DOING THIS....SORRY FOR THE LACK OF KNOWLEDGE.

AND HOW DO I STORE AND RUN IT ALSO

#12

ON THE GAL PER MIN ENTRY IT ASK WHAT GPM DO YOU WANT THEN TAKES THAT # DIV. BY GAL/STK AND IT WILL TELL YOU THE DESIRED STROKES PER MINUTE TO RUN SPM TO RUN TO ACHEIVE THAT GPM LEVEL.

THERE ARE WIDE VARIATIONS OF THIS PROGRAM AROUND...I AM TRYING TO EXPLAIN IT THE BEST I CAN.


#13

PLEASE TURN OFF YOUR CAPS LOOK.

Thanks.

#14

Hi, Brian;

if you are in trouble keying the program in your calculator, given that you already have the listing, maybe one of the best ways is actually to download the existing listing from the computer to the calculator through the connection cable. In some cases, when you are in the need to load the calculator with edited listings, editing in a PC and downloading it to the calculator may also be better and, occasionaly, faster.

I'm sending you an e-mail with some extra info, O.K.?

Best regards.

Luiz (Brazil)

Edited: 17 Jan 2006, 9:17 a.m.


#15

I do not have a program to write a calc. program on the computer in order to be able to download to the calc. I have the connectivity software, but I have not seen a way to actually edit or write programs on it to send to the calc.

Brian


#16

There is an error in that listing that may have prevented you from sending it to the calc. It was also missing the text header. Here's a corrected version:

%%HP: T(3)A(D)F(.)
\<<
"Enter Liner" "" INPUT OBJ\->
"Enter Stroke Length" "" INPUT OBJ\->
"Enter Efficiency" "" INPUT OBJ\->
"Enter Strokes/Minute" "" INPUT OBJ\->
\-> lin stl eff spm
\<<
lin SQ .000243 * stl * eff * .01 *
DUP "Bbl/Stroke = " SWAP + SWAP
42 *
\-> gps
\<<
"Gal/Stroke = " gps +
"Gal/Minute ="
gps spm * +
6 DISP
5 DISP
4 DISP
"Press a key to exit"
9 DISP
0 WAIT DROP
\>>
\>>
\>>

Cut and paste the above into notepad, and save as "pump.txt" Start the connectivity kit, cable up the calculator, start the xmodem server and connect with the connectivity kit. Check File->Transfer mode. If it is "binary", select it so you are in "text" mode. Drag pump.txt and drop it into the connectivity kit's view of the calculator file system. Select "Disconnect" from the Connectivity Kit menu. You should have a softkey labeled "pump" in the calculator directory you dropped the file on. That should do it.

You might want to have a look at
http://www.area48.com, which is a site for HP48 and HP49 beginners. The mother of all HP graphing calculator sites is Eric Rechlin's hpcalc.org. Despite excellent organization, it can be hard to find stuff there because there's just so much. But your time spent browsing will be rewarded with more knowledge about your calculator. I suggest you start with the FAQ, and then have a look at Programming in User RPL (zip file containing a PDF). The essential reference for programming in User RPL on the 49G+ is the Advanced User's Reference Manual (PDF). It's huge, but has a tutorial course in User RPL at the beginning, and contains detailed reference for all the User RPL words.

Finally, the Usenet news group comp.sys.hp48 is a good place to ask programming questions. This site is for older HP calculators, not current ones like the 49G+ The newsgroup is a better place to go with your questions.

Good luck!

Edited: 17 Jan 2006, 1:14 p.m.


#17

THanks for the help,,I got it on my calc.now but for some reason it does not run...or I just do not know how to run it.

Need a little more help.

Brian


#18

What happens when you press the softkey labeled "pump"? (Softkeys are the top row keys, under the "soft" labels.)

#19

You should also look at Hrast's message below. For $130.00, you could have a 42S emulator on your 49G+. You would have to key the programs by hand, but no translation would be needed.


#20

It brings up the program just like it was entered and sent to the calculator.

It does not actually run it.

it has a:
1: and the program is in qoutes.


I notice that there are g's in alot of the lines at the beginning some have 1 g and others have 2 g's.

Butit does noe execute the program.


#21

It sounds like the program transferred as a string, not as a program. That could happen if your cut-and-paste added characters, or if you were in binary mode when you transferred the program.

Delete the program off the calculator. (Press r-shift-files, OK, scroll down to the PUMP..." entry, press NEXT, then the PURGE softkey.) Download
the binary version here. Save it and reconnect to the calculator. Drag the saved file (PUMP.hp) into the connectivity kit window and proceed as above.

The text/binary mode probably wasn't the problem. I just transferred the text file to my 49G+ with the connectivity kit in binary mode, and the calc recognized it as a program without a problem. It's more likely some garbage was added when you did your cut-and-paste. (You needed to select just the program text before pressing ctl-c, for instance.) The binary version linked to above should get around that difficulty.


#22

Howard your incredible, The program works great!!!!! I copied and pasted it just like you mentioned and it still transfered as a string. Is there a way to set the connectivity program to binary and I assume that I was to set the calculater to ascii transfer. I might have been doing it all wrong. Still learning!

I have several other programs that I am needing to write in this code. By looking at the way the program was on the 42s I could follow it, but in the new RPL way it is very confusing for me. Any sugestions....most of the other (formula's) just get more complex.

Would you be interested in helping.

If so let me know.

Feel free to contact me by email

bdouglas1011@earthlink.net

Then I could get you my Contact #.

Thanks for your help!

#23

Quote:
It brings up the program just like it was entered and sent to the calculator.

It does not actually run it.

it has a: 1: and the program is in qoutes.


As you've already successfully downloaded the binary version, this
is acedemic, but at least part of the problem would be the header.
It should be:
%%HP: T(3)A(D)F(.);
instead of
%%HP: T(3)A(D)F(.)
Note the semicolon at the end of the ASCII transfer header.
Without a valid transfer header, the calculator stores whatever it
received as a character string.
Quote:
I notice that there are g's in alot of the lines at the beginning some have 1 g and others have 2 g's.

That I don't have any good explanation for. I do notice that
Howard posted the source code with tab characters where a series
of spaces would usually be, but that shouldn't matter, as either
tabs or spaces are parsed as separators.

I hope that you saved it as a "plain text" file rather than some
sort of "word processing" document. Generally, ASCII (text) source
code files are edited with a "text editor" rather than a "word
processor", but a word processor should work as long as the file
is saved as plain text.

I recommend uploading (in "ASCII" or "text" mode) some programs
(and other objects) that you've written and stored on the
calculator, to see what the header and source code should look
like in a text editor on your PC. Assuming that you're using
Conn4x for the transfer, I recommend configuring Conn4x to
translate all non-ASCII characters. If using some other method for
transfer, use translation mode 3, which can be set by the sequence
3 TRANSIO on the calculator.

Quote:
Butit does noe execute the program.

Well, what would be "executed" is the character string, which for
a "data class" object, means that it would simply be placed on the
stack.

As Howard wrote, the newsgroup comp.sys.hp48 seems to be a better
place to ask about RPL models.

Regards,
James

Edited: 18 Jan 2006, 4:40 a.m.


#24

does any one have any idea why this will not transfer and convert into binary mode.


%%HP: T(3)A(D)F(.)

\<<

"Enter Liner" "" INPUT OBJ\->

"Enter Stroke Length" "" INPUT OBJ\->

"Enter Efficiency" "" INPUT OBJ\->

"Enter Strokes/Minute" "" INPUT OBJ\->

\-> lin stl eff spm

\<<

lin SQ .000243 * stl * eff * .01 *

DUP "Bbl/Stroke = " SWAP + SWAP

42 *

\-> gps

\<<

"Gal/Stroke = " gps +

"Gal/Minute ="

gps spm * +

6 DISP

5 DISP

4 DISP

"Press a key to exit"

9 DISP

0 WAIT DROP

\>>

\>>

\>>

Edited: 23 Jan 2006, 10:59 p.m.


#25

Oh, heck.

James noticed this before. I left out a semicolon at the end of the header in this program. So

%%HP: T(3)A(D)F(.)

Should be

%%HP: T(3)A(D)F(.);

That's why it isn't transferring. In this case, the 49G+ will give a string conversion error, which doesn't tell you a darned thing, and Conn4X will report a transmission error. Very confusing.

Regards,
Howard.

#26

An error in the program will also give you a string conversion error, without telling you where exactly the error occurred. What I do in that case is I edit the file, replacing the outer program delimeters (the first \<<and the final \>>) with double quotes. That makes the 49G+ not do any string conversion, but just copy the contents over as text. Once on the calc, I edit the string and replace the quote marks with program delimeters. Then when I press enter, the calculator parses my program, gives me an intelligble error message and points to where the problem is. Much better!

That wouldn't have worked in this case, however, since the problem wasn't in the program but in the text header.

Regards,
Howard

Edited: 23 Jan 2006, 11:13 p.m.

#27

But he doesn't have a version for the 49G+, according to the referenced site.

There are HP-49G+ versions of all my emulators (http://hrastprogrammer.tripod.com/hp49gp.htm), I just haven't updated single emulator pages with this information. They don't have the same functionality as HP-48GX and HP-49G versions due to some HP-49G+ shortcomings and quirks (no RS-232, 128K Port1, some problems with ROM 2.0x, ...).

Edited: 17 Jan 2006, 1:24 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting Great Circle Navigation from 41C to 42S Bill Triplett 11 3,574 11-13-2013, 07:24 AM
Last Post: Kimberly Thompson
  HP Prime: Converting number to Sci notation and back BruceTTT 1 1,585 11-12-2013, 02:11 AM
Last Post: Phil Wipf
  [wp34s] Converting to/from IEEE 754 Binary64 (Double Precision) David Maier 1 1,171 06-15-2013, 09:21 PM
Last Post: Paul Dale
  OT - Converting 9 track 6250 bpi tapes Marcel Samek 0 930 05-31-2013, 08:26 PM
Last Post: Marcel Samek
  HP42s input output of programs and files aurelio 17 4,659 09-01-2012, 10:18 PM
Last Post: Raymond Del Tondo
  HP42S John Mosand 5 2,544 07-22-2012, 03:13 AM
Last Post: Les Koller
  HP42S graphics Han 2 1,590 07-20-2012, 12:23 AM
Last Post: Raymond Del Tondo
  HP42s ROM aurelio 18 8,821 06-26-2012, 09:36 AM
Last Post: Thomas Klemm
  x root y on hp42s David Griffith 14 5,012 04-08-2012, 12:43 PM
Last Post: Walter B
  HP42s - deal? Cristian Arezzini 26 8,044 02-19-2012, 10:05 AM
Last Post: Cristian Arezzini

Forum Jump: