UserRPL HP 50G
06-29-2014, 07:01 PM
Post: #1
 Mikkiz Junior Member Posts: 4 Joined: Jun 2014
UserRPL HP 50G
Hey,

i am new to the HP 50G and i've tried to program something with HpUserEdit5. Sadly i dont know why i get always STR -> Error: Invalid Syntax. Could any1 give me a hint or show me how to do it right?

http://view.samurajdata.se/psview.php?id...8b6&page=1 <--- the program, to switch pages check the left side

06-29-2014, 09:20 PM
Post: #2
 DavidM Senior Member Posts: 757 Joined: Dec 2013
RE: UserRPL HP 50G
(06-29-2014 07:01 PM)Mikkiz Wrote:  http://view.samurajdata.se/psview.php?id...8b6&page=1 <--- the program, to switch pages check the left side

Are you able to simply post the code here? The "pdf translator" you've linked to above only shows graphic images of the code, and some of the characters didn't get translated properly (they show up as ?s). Some of those placeholders are easy to decipher, others aren't.

Also, does HPUserEdit do something special with lines that begin with "//"? Those appear to be comments, but "//" isn't recognized by the 50g as a comment token. It's possible that HPUserEdit strips those lines out, though. I'm just not familiar with that app.

Regards -
David
06-30-2014, 04:00 PM (This post was last modified: 06-30-2014 04:01 PM by Mikkiz.)
Post: #3
 Mikkiz Junior Member Posts: 4 Joined: Jun 2014
RE: UserRPL HP 50G
hey and thanks for your fast reply. the \\ are only comments for the forum, that people understand what it does if they want to. i thought the ? belongs to the code, its at least how i learned it.

Quote:%%HP: T(0)A(D)F(.);
@ Argumentos:
@ Author:
@ E-mail:
@ Version:
@ Created using HPUserEdit 5 [www.unparche.com]

@ %NAME%=
@ %DIR%=

«

// Input box, T = Sum

{ {"xf" "Lower Limit"}

{"xd" "Upper Limit"}

{"v" "Reflux Ratio"}

{"a" "Segregation Factor"}

{"n" "Partitions"} }

1 { } { } INFORM

IF 0 == THEN KILL END

OBJ-> DROP

// Calculate h and store 0 in T, s1, and s2

4 PICK 6 PICK ? 2 PICK /

0 DUP DUP

// Store local variables

-> xf xd v ? n h T s1 s2

«

// Subroutines

« v xi * xd + v 1 + / » ?y? STO

« ? xi * 1 ? 1 ? xi * + / » ?ys? STO

« ys -> NUM y -> NUM ? INV » ?F? STO

// Endpoints

xf ?xi? STO F ?T? STO+

xd ?xi? STO F ?T? STO+

// Inner terms of the Simpson Rule

0 n 2 / 1 ? FOR K

2 K * 1 + h * xf + ?xi? STO

F ?s1? STO+ NEXT

0 n 2 / 1 ? FOR K

2 K * h * xf + ?xi? STO

F ?s2? STO+ NEXT

// Calculating the integral

s1 4 * ?T? STO+

s2 2 * ?T? STO+

T h 3 / *

// Finalizing

v DUP 1 + / * ?T? STO

// Display T and purge outstanding variables

T ?Result? ->TAG { xi, F, ys, y} PURGE »
»
06-30-2014, 04:23 PM
Post: #4
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(06-30-2014 04:00 PM)Mikkiz Wrote:  hey and thanks for your fast reply. the \\ are only comments for the forum, that people understand what it does if they want to. i thought the ? belongs to the code, its at least how i learned it.

You should use @ for comments, either at the beginning of a line or to explain some section of code

Code:
BOP BAM BOOM @ batman's revenge

I suspect the ? character is supposed to be a single quote.

It ain't OVER 'till it's 2 PICK
06-30-2014, 05:55 PM
Post: #5
 DavidM Senior Member Posts: 757 Joined: Dec 2013
RE: UserRPL HP 50G
(06-30-2014 04:00 PM)Mikkiz Wrote:  the \\ are only comments for the forum, that people understand what it does if they want to.

I understand that you intend for those lines to be comments, but the 50g doesn't recognize "//" as a comment indicator. As a result, the 50g will attempt to interpret those lines as RPL code. It's possible that HPUserEdit doesn't pass those lines along to the calculator, though. I'm not familiar with HPUserEdit, so I can't say with certainty how it treats those lines.

(06-30-2014 04:00 PM)Mikkiz Wrote:  i thought the ? belongs to the code, its at least how i learned it.

Many of those ?s are actually supposed to be single quotes, such as in these lines:
Code:
xf ?xi? STO F ?T? STO+ xd ?xi? STO F ?T? STO+

They should actually be coded as follows:
Code:
xf 'xi' STO F 'T' STO+ xd 'xi' STO F 'T' STO+

There's other places where ?s show up, though, and it's apparent that they aren't supposed to be single quotes. Your program will have syntax errors until you remove all the ?s and replace them with the appropriate substitutions.

Generally speaking, you're better off when you use the HP "tri-graphs" in your code instead of using special characters. So instead of using "«" and "»", you would use "\<<" and "\>>". Also in your code, you have:
Code:
OBJ-> DROP
...which will definitely create an error. You should use
Code:
OBJ\-> DROP

Likewise for
Code:
->
you would use
Code:
\->
The tri-graphs are converted to single characters as appropriate when the 50g compiles the program.
06-30-2014, 06:31 PM
Post: #6
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(06-30-2014 05:55 PM)DavidM Wrote:  The tri-graphs are converted to single characters as appropriate when the 50g compiles the program.

Is that true even for %%HP: T(0)A(D)F(.); as he posted? Or do you have to 3 TRANSIO?

It ain't OVER 'till it's 2 PICK
06-30-2014, 06:59 PM
Post: #7
 DavidM Senior Member Posts: 757 Joined: Dec 2013
RE: UserRPL HP 50G
(06-30-2014 06:31 PM)HP67 Wrote:
(06-30-2014 05:55 PM)DavidM Wrote:  The tri-graphs are converted to single characters as appropriate when the 50g compiles the program.
Is that true even for %%HP: T(0)A(D)F(.); as he posted? Or do you have to 3 TRANSIO?

That's a good point. At least when connecting with Conn4x (aka the HP Connectivity Kit), tri-graphs are always converted when sending files to the calculator, regardless of TRANSIO mode. The reverse isn't always true, though. The settings of the 50g and/or software will determine how the translations occur when retrieving files from the calculator.

Since Mikkiz is using HPUserEdit, I'm not sure what rules apply. It may have its own comm link with the 50g.
07-01-2014, 12:26 AM (This post was last modified: 07-01-2014 12:38 AM by CosmicTruth.)
Post: #8
 CosmicTruth Member Posts: 164 Joined: May 2014
RE: UserRPL HP 50G
(06-29-2014 07:01 PM)Mikkiz Wrote:  Hey,

i am new to the HP 50G and i've tried to program something with HpUserEdit5. Sadly i dont know why i get always STR -> Error: Invalid Syntax. Could any1 give me a hint or show me how to do it right?

http://view.samurajdata.se/psview.php?id...8b6&page=1 <--- the program, to switch pages check the left side

You should try inputting the code directly into the calculator right between the << and the >>. put small parts in and save it often till you get all the code in, this way you can see syntax errors as you attempt to store the program, and also you can run the code in part to see what it does.

the first error I see on entering your code, is you have to have a "FORM NAME" string in front of the inform prompt list or it errors.

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
07-01-2014, 06:27 AM
Post: #9
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(06-30-2014 06:59 PM)DavidM Wrote:  At least when connecting with Conn4x (aka the HP Connectivity Kit), tri-graphs are always converted when sending files to the calculator, regardless of TRANSIO mode. The reverse isn't always true, though. The settings of the 50g and/or software will determine how the translations occur when retrieving files from the calculator.

Thanks for the clarification. I'm using C-Kermit exclusively and it appears I need to pay attention and set TRANSIO manually in some, possibly many cases.

It ain't OVER 'till it's 2 PICK
07-01-2014, 05:25 PM (This post was last modified: 07-01-2014 05:34 PM by Mikkiz.)
Post: #10
 Mikkiz Junior Member Posts: 4 Joined: Jun 2014
RE: UserRPL HP 50G
Hey,

thanks for the replies!!!

First i have to say, i am new to the HP 50G and new to RPN so sorry for my mistakes. I've tried to program the Simpson Rule like in this video Simpson Rule on Youtube, i just tried to change the input mode that i dont have to write 'F(x)=...' and so on.

i've changed the code abit the most ? are gone, sadly i dont have the code on my pc here due to a pc crash, so i had to remake it again. I've also attached a picture which displays what i want to calculate, if there are some questions.

any1 here programs in Algebraic mode? (i cant find good tutorials >.<)
are there better programs than HpUserEdit?

Quote:%%HP: T(0)A(D)F(.);
@ Argumentos:
@ Author:
@ E-mail:
@ Version:
@ Created using HPUserEdit 5 [www.unparche.com]

@ %NAME%=
@ %DIR%=

«

@ Input box, T = Sum

{ {"xf" "Lower Limit"}

{"xd" "Upper Limit"}

{"v" "Reflux Ratio"}

{"a" "Segregation Factor"}

{"n" "Partitions"} }

2 { } { } INFORM

IF 0 == THEN KILL END

OBJ-> DROP

@ Calculate h and store 0 in T, s1, and s2

4 PICK 6 PICK ? 2 PICK / @ that ? confuses me abit

0 DUP DUP

@ Store local variables

-> xf xd v a n h T s1 s2

«

@ Subroutines

« v xi * xd + v 1 + / » 'y' STO

« a xi * 1 xi 1 a - * + / » 'ys' STO

« ys -> NUM y -> NUM ? INV » 'F' STO @ Do i have to change ? with F or with 1

@ Endpoints

xf 'xi' STO F 'T' STO+

xd 'xi' STO F 'T' STO+

@ Inner terms of the Simpson Rule

0 n 2 / 1 ? FOR K

2 K * 1 + h * xf + 'xi' STO

F 's1' STO+ NEXT

0 n 2 / 1 ? FOR K

2 K * h * xf + 'xi' STO

F 's2' STO+ NEXT

@ Calculating the integral

s1 4 * 'T' STO+

s2 2 * 'T' STO+

T h 3 / *

@ Finalizing

v DUP 1 + / * 'T' STO

@ Display T and purge outstanding variables

T 'Result' ->TAG { xi, F, ys, y} PURGE »
»

Attached File(s) Thumbnail(s)

07-01-2014, 05:35 PM
Post: #11
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(07-01-2014 05:25 PM)Mikkiz Wrote:  First i have to say, i am new to the HP 50G

Hi. First, have you gotten all the manuals from HP? You can find them here http://bit.ly/1pHg2yz

If you wrap code tags (see # icon above in edit mode) around your code it will be much easier to read than pasting or quoting text.

(07-01-2014 05:25 PM)Mikkiz Wrote:  any1 here programs in Algebraic mode? (i cant find good tutorials >.<)

No, that would be very wrong. If you learn RPL you'll be able to get the full power of the calculator. There is a lot that it cannot do in Algebraic mode, especially when it comes to programming.

(07-01-2014 05:25 PM)Mikkiz Wrote:  are there better programs than HpUserEdit?

I have no idea what you are trying to do, and I have no idea what HpUserEdit is.

If you can explain what you want to do, I'm sure somebody here can help.

It ain't OVER 'till it's 2 PICK
07-01-2014, 08:02 PM
Post: #12
 DavidM Senior Member Posts: 757 Joined: Dec 2013
RE: UserRPL HP 50G
(07-01-2014 05:25 PM)Mikkiz Wrote:  i've changed the code abit the most ? are gone, sadly i dont have the code on my pc here due to a pc crash, so i had to remake it again. I've also attached a picture which displays what i want to calculate, if there are some questions.

I'm going to guess that you originally used a word processing application to type in the code, because it appears that most of the characters that didn't translate well were either a single quote (') or dash/minus (-). Those characters are frequently "auto-substituted" by word processors to be other characters, which might explain why they didn't make it to your final code properly.

With that in mind, I made an attempt to correct a few obvious syntactical errors in your code and came up with the following:
Code:
\<< @ Input box, T = Sum "TITLE" { {"xf" "Lower Limit"} {"xd" "Upper Limit"} {"v" "Reflux Ratio"} {"a" "Segregation Factor"} {"n" "Partitions"} } 2 { } { } INFORM IF 0 == THEN KILL END OBJ\-> DROP @ Calculate h and store 0 in T, s1, and s2 4 PICK 6 PICK - 2 PICK / @ that ? confuses me abit 0 DUP DUP @ Store local variables \-> xf xd v a n h T s1 s2 \<< @ Subroutines \<< v xi * xd + v 1 + / \>> 'y' STO \<< a xi * 1 xi 1 a - * + / \>> 'ys' STO \<< ys \->NUM y \->NUM - INV \>> 'F' STO @ Do i have to change ? with F or with 1 @ Endpoints xf 'xi' STO F 'T' STO+ xd 'xi' STO F 'T' STO+ @ Inner terms of the Simpson Rule 0 n 2 / 1 - FOR K 2 K * 1 + h * xf + 'xi' STO F 's1' STO+ NEXT 0 n 2 / 1 - FOR K 2 K * h * xf + 'xi' STO F 's2' STO+ NEXT @ Calculating the integral s1 4 * 'T' STO+ s2 2 * 'T' STO+ T h 3 / * @ Finalizing v DUP 1 + / * 'T' STO @ Display T and purge outstanding variables T 'Result' \->TAG { xi, F, ys, y} PURGE \>> \>>

This should at least get you to the point of being able to run the program and start the debugging process. I made no logical changes at all, but the following items were changed to allow it to meet syntax requirements:

1) All instances of "->" were converted to "\->"
2) All instances of "«" were converted to "\<<"
3) All instances of "»" were converted to "\>>"
4) "-> NUM" was converted to "\->NUM" (and you may actually need EVAL in those positions, so you may want to check on that)
5) I added a title string ("TITLE") which INFORM needs as a parameter.
6) I changed from double spacing to single spacing
7) I changed the ?s in these lines to dashes:
Code:
4 PICK 6 PICK ? 2 PICK / 0 n 2 / 1 ? FOR K 0 n 2 / 1 ? FOR K

(07-01-2014 05:25 PM)Mikkiz Wrote:  any1 here programs in Algebraic mode? (i cant find good tutorials >.<)

Programming documentation for HP-48/49/50 systems using Algebraic mode is practically non-existent. You'll find the opposite is true for using the 50g in RPN mode. I doubt there's anyone that frequents this forum that uses Algebraic mode on their HP calculators for normal work, so this may not be the best place to seek that kind of assistance.

(07-01-2014 05:25 PM)Mikkiz Wrote:  are there better programs than HpUserEdit?

My only exposure to HPUserEdit is seeing a youtube demonstration of it, and I'm afraid I couldn't understand the dialogue of the speaker because I'm not fluent enough in Spanish to understand what he was saying. That said, the demo he provided showed some very nice features for User RPL editing with that program.

I do most of my 50g programming using Debug4x on a Windows-based laptop. It does provide some nice functionality for User RPL programming, but its strength is really System RPL and Saturn Assembly coding. Just based on the demo of HPUserEdit that I saw, I would think that Debug4x would feel like a step down from that environment. You may want to take a look at it, though, if you're wanting to investigate other options for PC-based 50g programming tools.

Hope this helps!
- David
07-02-2014, 07:44 PM
Post: #13
 Mikkiz Junior Member Posts: 4 Joined: Jun 2014
RE: UserRPL HP 50G
Thanks guys!!!!!

i've got the program working, the solution of the calculation isnt right, i think the "h" is the problem, the solution should be 7,65 but it is 6,05 with n = 5 >.<
I'll start to learn RPN soon as i got more time, exams are incoming >.< My previous calculator used the algebraic mode so i hoped it would be easier to calculate/program with that until i'll learn RPN.

(07-01-2014 05:35 PM)HP67 Wrote:
(07-01-2014 05:25 PM)Mikkiz Wrote:  are there better programs than HpUserEdit?
I have no idea what you are trying to do, and I have no idea what HpUserEdit is.
If you can explain what you want to do, I'm sure somebody here can help.

Its just a programming environment to write write your program, it got an Emulator to check it before you put it on your real Calculator. but i'll check debug4x maybe it fits better to me. Thanks for the links for the manuals i just had the "little" user manual with no programming in it.

Code:
%%HP: T(0)A(D)F(.); « @ Input box, T = Sum "NTU Kopf" { { "xf" "Lower Limit"} { "xd" "Upper Limit"} { "v" "Reflux Ratio"} { "a" "Segregation Factor"} { "n" "Partitions"} } 2 { } { } INFORM IF 0 == THEN KILL END OBJ-> DROP @ Calculate h and store 0 in T, s1, and s2 4 PICK 6 PICK - 2 PICK / 0 DUP DUP @ Store local variables -> xf xd v a n h T s1 s2 « @ Subroutines « v xi * xd + v 1 + / » 'y' STO « a xi * 1 a 1 - xi * + / » 'ys' STO « ys ->NUM y ->NUM - INV » 'F' STO @ Endpoints xf 'xi' STO F 'T' STO+ xd 'xi' STO F 'T' STO+ @ Inner terms of the Simpson Rule 0 n 2 / 1 - FOR K 2 K * 1 + h * xf + 'xi' STO F 's1' STO+ NEXT 0 n 2 / 1 - FOR K 2 K * h * xf + 'xi' STO F 's2' STO+ NEXT @ Calculating the integral s1 4 * 'T' STO+ s2 2 * 'T' STO+ T h 3 / * @ Finalizing v DUP 1 + / * 'T' STO @ Display T and purge outstanding variables T 'Result' ->TAG { xi, F, ys, y } PURGE »

Attached File(s) Thumbnail(s)

Post: #14
 Brad Barton Member Posts: 188 Joined: Jan 2014
RE: UserRPL HP 50G
After seeing what you're trying to accomplish, debug4x might be a bit of overkill. Try WinHP here http://sourceforge.net/projects/winhp/ . I use it for generating programs for my HP-48, and it's very convenient because typing long programs into the 48 is pretty tedious using the calculator's keyboard. It could be exactly what you're looking for.

I'm not entirely sure that it will work with the HP-50, but it will produce files for the 49, so I don't see why it wouldn't work. It's not as deep as debug4x, but it doesn't need to be.
07-03-2014, 06:29 AM (This post was last modified: 07-03-2014 06:29 AM by HP67.)
Post: #15
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(07-02-2014 07:44 PM)Mikkiz Wrote:  I'll start to learn RPN soon as i got more time, exams are incoming >.< My previous calculator used the algebraic mode so i hoped it would be easier to calculate/program with that until i'll learn RPN.

The 50g uses RPL, not RPN. RPN is the system on HP's calculators that use a 4 level stack. RPL is a complete FORTH-like programming environment with an unlimited stack. FORTH and RPL are not the easiest things to learn, but they are very powerful and ideally suited to a calculator or other small device. Once you get the hang of it I'm sure you'll do fine.

I code on the calculator and I don't use Windows so I don't have any tools for formatting or testing programs.

It ain't OVER 'till it's 2 PICK
07-03-2014, 08:13 AM (This post was last modified: 07-03-2014 08:14 AM by Joe Horn.)
Post: #16
 Joe Horn Senior Member Posts: 1,591 Joined: Dec 2013
RE: UserRPL HP 50G
(07-03-2014 06:29 AM)HP67 Wrote:  The 50g uses RPL, not RPN. RPN is the system on HP's calculators that use a 4 level stack.

If the 50g is not RPN, then why does it have an "RPN" setting (the very top setting in the MODE screen)? Answer: the 50g DOES have RPN, which stands for Reverse Polish Notation, which the 50g obviously supports. Does "1 ENTER 2 +" yield 3? Yes. Therefore, it's an RPN calculator, no matter what you need to press to separate the 1 and 2 (e.g. you can use the space key on the 50g instead of ENTER), and no matter how many stack levels your machine has, and no matter whether typing 3 ENTER gives you one or two 3's, and so on.

RPL is a Language (hence the "L"): the language used for programming the 28/48/49/50, and for typing commands on the command line. RPN is a Notation (hence the "N") in which there are no prefixes like SIN(pi), or infixes like 1+2, but only postfixes like pi SIN, and 1 2 +. The 50g has both RPL and RPN; saying that it has RPL instead of RPN is to misunderstand what both are.

<0|ɸ|0>
-Joe-
07-03-2014, 11:07 AM
Post: #17
 Voldemar Member Posts: 220 Joined: Mar 2014
RE: UserRPL HP 50G
(07-03-2014 08:13 AM)Joe Horn Wrote:
(07-03-2014 06:29 AM)HP67 Wrote:  The 50g uses RPL, not RPN. RPN is the system on HP's calculators that use a 4 level stack.

If the 50g is not RPN, then why does it have an "RPN" setting (the very top setting in the MODE screen)? Answer: the 50g DOES have RPN, which stands for Reverse Polish Notation, which the 50g obviously supports. Does "1 ENTER 2 +" yield 3? Yes. Therefore, it's an RPN calculator, no matter what you need to press to separate the 1 and 2 (e.g. you can use the space key on the 50g instead of ENTER), and no matter how many stack levels your machine has, and no matter whether typing 3 ENTER gives you one or two 3's, and so on.

RPL is a Language (hence the "L"): the language used for programming the 28/48/49/50, and for typing commands on the command line. RPN is a Notation (hence the "N") in which there are no prefixes like SIN(pi), or infixes like 1+2, but only postfixes like pi SIN, and 1 2 +. The 50g has both RPL and RPN; saying that it has RPL instead of RPN is to misunderstand what both are.

+1
07-03-2014, 11:15 AM
Post: #18
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(07-03-2014 08:13 AM)Joe Horn Wrote:
(07-03-2014 06:29 AM)HP67 Wrote:  The 50g uses RPL, not RPN. RPN is the system on HP's calculators that use a 4 level stack.

The 50g has both RPL and RPN; saying that it has RPL instead of RPN is to misunderstand what both are.

Well, now. It's as if I sold you a Prime without wireless.

It ain't OVER 'till it's 2 PICK
07-03-2014, 11:18 AM
Post: #19
 HP67 Senior Member Posts: 610 Joined: Dec 2013
RE: UserRPL HP 50G
(07-03-2014 11:07 AM)Voldemar Wrote:  +1

There's another guy who couldn't find the RPN mode on his calculator

It ain't OVER 'till it's 2 PICK
07-04-2014, 12:32 AM
Post: #20
 CosmicTruth Member Posts: 164 Joined: May 2014
RE: UserRPL HP 50G
(07-03-2014 08:13 AM)Joe Horn Wrote:  ...Does "1 ENTER 2 +" yield 3? Yes. Therefore, it's an RPN...

"HP No Equal"

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
 « Next Oldest | Next Newest »

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