# HP 50g simple programming - Hewlett Packard

This is a discussion on HP 50g simple programming - Hewlett Packard ; I have a HP 50g calculator, just want to wirte some simple program, like input R, the program calculates the circle area; input L, H, W, then the program can calculate the surface area, ect. I read the user menu, ...

# Thread: HP 50g simple programming

1. ## HP 50g simple programming

I have a HP 50g calculator, just want to wirte some simple program,
like input R, the program calculates the circle area; input L, H, W,
then the program can calculate the surface area, ect. I read the user
showed the detailed programming steps, but it was broken. Who is
familiar with 50g programming and can show me a couple of simple
program, I would so appreciate.

2. ## Re: HP 50g simple programming

Well, the 42s is programmed in RPN, the 50G in UserRPL. That's a big
difference.

Get yourself the HP 49G+ Advanced User's Reference Manual (AUR) in pdf

Programming in UserRPL can still be very simple:

Having value for height, width and length on the stack, you can use this
program to have the resulting volume on stack level 1:

<< -> H W L << H W L * *>> >>

<< >> being keyed in by [Right Shift] [+]
and
-> by [Right Shift][0]

Have fun!

GeorgeBailey

3. ## Re: HP 50g simple programming

"George Bailey" wrote in message
news:gdus4g$t4g$1@online.de...
> Well, the 42s is programmed in RPN, the 50G in UserRPL. That's a big
> difference.
>
> Get yourself the HP 49G+ Advanced User's Reference Manual (AUR) in pdf for
>
> Programming in UserRPL can still be very simple:
>
> Having value for height, width and length on the stack, you can use this
> program to have the resulting volume on stack level 1:
>
> << -> H W L << H W L * *>> >>

or just << * * >>
inputting r and getting 2 pi r

<< 2 * pi * ->NUM @ ensure symbolic pi is numeric
>>

pi is [Left-Shift] [SPC]

> << >> being keyed in by [Right Shift] [+]
> and
> -> by [Right Shift][0]
>
> Have fun!
>
> GeorgeBailey

4. ## Re: HP 50g simple programming

Veli-Pekka Nousiainen schrieb:
> or just << * * >>

I seriously question the need for a program in this case ;-)

http://www.hpcalc.org/hp49/docs/misc/hp49gpaur.zip

with many programming examples.

Cheers,
George

5. ## Re: HP 50g simple programming

On Oct 24, 7:46*pm, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; *input L, H, W,
> then the program can calculate the surface area, ect. *I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Calculate area of circle:
area = pi * r^2
On HP 50:

<<
SQ 3.14159265359 *
"Area" ->TAG
>>

Store the program in a
variable named AREA:

1. Open program delimiters
with rt. shift << >>. Look
above the [+] key.
2. Type in the program.
3. Press [ENTER] to place
program on the stack.
4. Press the [ ' O] key. It
is the key with MTRW EQW
above it.
5. Type in AREA then [ENTER].
6. Press the [STO] key to
store the program.
7. To use the program enter
a number in stack level one
and then press the soft key

Example:

Input: 1: 5.00
Output: 1: Area:78.54

8. Go to [CONST] in the
to get pi.
9. Enter 2 FIX to display
two places after the
decimal point.
10. I'm using an hp 49g+
so if any keys are different
from your hp 50 I apologize

6. ## Re: HP 50g simple programming

On Oct 25, 2:46 am, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; input L, H, W,
> then the program can calculate the surface area, ect. I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Welcome. There are several different ways to accomplish this. In the
programs below, \-> is the RightShift 0 character.

If you want to enter L, H, and W on the stack and have the program
calculate the surface area of a rectangular box, the simplest approach
would be to define a function:

\<< \-> L H W '2*(L*W+L*H+H*W)' \>>

Or coming from a 42s, you might prefer a stack manipulation program:

\<< 3. DUPN * UNROT * + UNROT * + 2 * \>>

If you want the program to prompt the user for input, you could do
something like:

\<<
"Enter Length" "" INPUT STR\->
"Enter Height" "" INPUT STR\->
"Enter Width" "" INPUT STR\->
\-> L H W '2*(L*W+L*H+H*W)'
\>>

And finally if you want a form to fill in with tagged output:

\<<
"Surface Area of Box"
{ "Length:" "Height:" " Width:" }
{ 1. 0. }
{ 1 1 1 }
DUP
INFORM
IF
THEN
OBJ\-> DROP
\-> L H W '2*(L*W+L*H+H*W)'
END
"Area"
\->TAG
\>>

Hope this points you in the right direction.

-wes

7. ## Re: HP 50g simple programming

On Oct 24, 7:46*pm, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; *input L, H, W,
> then the program can calculate the surface area, ect. *I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

EQNLIB (libraries 226 and 227) came with the calculator. For your
problems, use Plane Geometry and Solid Geometry. Enter in the known
values and the tell the calculator which variable to solve for.

Otherwise, read Chapter 21 on the 50g User's Guide (the PDF) for

S.C.

8. ## Re: HP 50g simple programming

Simple example program for area of a circle:

<< Pi SWAP 2 ^ * EVAL>> ENTER
AREA STO

(There you store your program into AREA variable)

Then just put R on the stack and press the corresponding softkey to
execute the AREA program.

Another way:

<< -> R 'Pi*R^2' EVAL>> ENTER
ENTER

Again, just put R on the stack and press the corresponding softkey to
execute the AREA program.

9. ## Re: HP 50g simple programming

On Oct 24, 7:46*pm, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; *input L, H, W,
> then the program can calculate the surface area, ect. *I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Greetings,

Calculate area of circle:
area = pi * r^2

On the HP 50:

<<
SQ 3.14159265359 *
"Area" ->TAG
>>

Store the program in a
variable named AREA:

1. Open program delimiters
with rt. shift << >>. Look
above the [+] key.
2. Type in the program.
3. Press [ENTER] to place
program on the stack.
4. Press the [ ' O] key. It
is the key with MTRW EQW
above it.
5. Type in AREA then [ENTER].
6. Press the [STO] key to
store the program.
7. To use the program enter
a number in stack level one
and then press the soft key

Example:

Input: 1: 5.00

Output: 1: Area:78.54

8. Go to [CONST] in the
to get pi.
9. Enter 2 FIX to display
two places after the
decimal point.
10. I'm using an hp 49g+
so if any keys are different
from your hp 50 I apologize

Calculate surface area
of rectangular prism:
2*L*W + 2*L*H + 2*W*H

<<
3 DUPN * 2 * @ Face A
5 ROLLD * 2 * @ Face B
4 ROLLD * 2 * @ Face C
+ + "Area" ->TAG @ Area
>>

Note: @ begins a comment and
is not part of the program.
It is for documentation only.

Example:

Input: 3: 22 @ Length
2: 16 @ Width
1: 11 @ Height

Output: 1: Area:1,540.00

Regards,

Mark

10. ## Re: HP 50g simple programming

On Fri, 24 Oct 2008 18:46:26 -0500:

> I have a HP 50g calculator, just want to write some simple program,
> like input R, the program calculates the circle area;
> input L, H, W, then the program can calculate the surface area, etc.

All things representable by formulas can be calculated directly
using the numeric solver (just as on the HP42S),
and you can save a set of your own equations,
then choose any one to solve (for any variable,
not just calculating one particular variable from the others);
for example, in RPN mode:

'A=\pi*R^2' 'CIRCA' STO

'A=(L*H+H*W+W*L)*2' 'BOXA' STO

\<< "Choose formula" 9 TVARS 1 CHOOSE
{ STEQ 30 MENU } IFT \>> 'MYEQS' STO

The 'MYEQS' program chooses any formula in the current directory,
then starts the menu-based solver (like that of the HP42S).

You can also just start the form-based numeric solver
(Right-shift NUM.SLV "Solve Equation")
and choose an equation using the form,
rather than using a program.

A slight expansion of the 'MYEQS' program could permit
navigating through a directory tree,
as well as picking equations from a single directory.

Solving equations like this
will store additional variables named in the formulas,
containing numeric data;
when you no longer need to save any such variables,
you can purge them all from the current directory,
plus any left-over "current equation(s)" and solver data using:

\<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO

Numeric values with attached "units" (e.g. 3.2_cm)
may be included in this "clean-up"
by expanding the list of object types to { 0 13 28 }

All of the above works in all HP48G/49G/50G series.

[r->] [OFF]

11. ## Re: HP 50g simple programming

On Oct 24, 7:46*pm, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; *input L, H, W,
> then the program can calculate the surface area, ect. *I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Greetings,

Calculate area of circle:
area = pi * r^2

On the HP 50:

<<
SQ 3.14159265359 *
"Area" ->TAG
>>

Store the program in a
variable named AREA:

1. Open program delimiters
with rt. shift << >>. Look
above the [+] key.
2. Type in the program.
3. Press [ENTER] to place
program on the stack.
4. Press the [ ' O] key. It
is the key with MTRW EQW
above it.
5. Type in AREA then [ENTER].
6. Press the [STO] key to
store the program.
7. To use the program enter
a number in stack level one
and then press the soft key

Example:

Input: 1: 5.00

Output: 1: Area:78.54

8. Go to [CONST] in the
to get pi.
9. Enter 2 FIX to display
two places after the
decimal point.

Note: I'm using an hp 49g+
so if any keys are different
from your hp 50 I apologize

Calculate surface area
of rectangular prism:
2*L*W + 2*L*H + 2*W*H

<<
3 DUPN * 2 * @ Face A
5 ROLLD * 2 * @ Face B
4 ROLLD * 2 * @ Face C
+ + "Area" ->TAG @ Area
>>

Note: @ begins a comment and
is not part of the program.
It is for documentation only.

Example:

Input: 3: 22 @ Length
2: 16 @ Width
1: 11 @ Height

Output: 1: Area:1,540.00

Regards,

Mark

12. ## Re: HP 50g simple programming

On Oct 25, 2:46 am, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; input L, H, W,
> then the program can calculate the surface area, ect. I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Welcome. There are several different ways to accomplish this.

If you want to enter L, H, and W on the stack and have the program
calculate the surface area of a rectangular box, the simplest approach
would be to define a function:

\<< \-> L H W '2*(L*W+L*H+H*W)' \>>

where \<< and \>> are the program brackets, RightShift +, and \-> is
RightShift 0.

Or coming from a 42s, you might prefer a stack manipulation program:

\<< 3. DUPN * UNROT * + UNROT * + 2 * \>>

If you want the program to prompt the user for input, you could do
something like:

\<<
"Enter Length" "" INPUT STR\->
"Enter Height" "" INPUT STR\->
"Enter Width" "" INPUT STR\->
\-> L H W '2*(L*W+L*H+H*W)'
\>>

And finally if you want a form to fill in with tagged output:

\<<
"Surface Area of Box"
{ "Length:" "Height:" " Width:" }
{ 1. 0. }
{ 1 1 1 }
DUP
INFORM
IF
THEN
OBJ\-> DROP
\-> L H W '2*(L*W+L*H+H*W)'
"Area"
\->TAG
END
\>>

Hope this points you in the right direction.

-wes

13. ## Re: HP 50g simple programming

On Oct 25, 10:46*am, kx...@hotmail.com wrote:
> I have a HP 50g calculator, just want to wirte some simple program,
> like input R, the program calculates the circle area; *input L, H, W,
> then the program can calculate the surface area, ect. *I read the user
> showed the detailed programming steps, but it was broken. Who is
> familiar with 50g programming and can show me a couple of simple
> program, I would so appreciate.

Try that:
« "SURFACE AREA OF BOX:" DUP
{ ":L:
:H:
:W: " { 1. 5. } V } INPUT
CLLCD 7. FREEZE
SWAP 1. DISP DUP 3. DISP
OBJ-> 3. DUPN * UNROT * + UNROT * + 2. * ":A: " OVER + 7. DISP
»

Cheers,
Reth

14. ## Re: HP 50g simple programming

On Oct 26, 6:44*pm, Wes wrote:
> On Oct 25, 2:46 am, kx...@hotmail.com wrote:
>
> > I have a HP 50g calculator, just want to wirte some simple program,
> > like input R, the program calculates the circle area; *input L, H, W,
> > then the program can calculate the surface area, ect. *I read the user
> > showed the detailed programming steps, but it was broken. Who is
> > familiar with 50g programming and can show me a couple of simple
> > program, I would so appreciate.

>
> Welcome. *There are several different ways to accomplish this.
>
> If you want to enter L, H, and W on the stack and have the program
> calculate the surface area of a rectangular box, the simplest approach
> would be to define a function:
>
> \<< \-> L H W '2*(L*W+L*H+H*W)' \>>
>
> where \<< and \>> are the program brackets, RightShift +, and \-> is
> RightShift 0.
>
> Or coming from a 42s, you might prefer a stack manipulation program:
>
> \<< 3. DUPN * UNROT * + UNROT * + 2 * \>>
>
> If you want the program to prompt the user for input, you could do
> something like:
>
> \<<
> * "Enter Length" "" INPUT STR\->
> * "Enter Height" "" INPUT STR\->
> * "Enter Width" "" INPUT STR\->
> * \-> L H W '2*(L*W+L*H+H*W)'
> \>>
>
> And finally if you want a form to fill in with tagged output:
>
> \<<
> * "Surface Area of Box"
> * { "Length:" "Height:" " Width:" }
> * { 1. 0. }
> * { 1 1 1 }
> * DUP
> * INFORM
> * IF
> * THEN
> * * OBJ\-> DROP
> * * \-> L H W '2*(L*W+L*H+H*W)'
> * * "Area"
> * * \->TAG
> * END
> \>>
>
> Hope this points you in the right direction.
>
> -wes

Or try this:

\<< "SURFACE AREA OF BOX:" DUP { ":L:
:H:
:W: " { 1. 5. } V } INPUT CLLCD 7. FREEZE SWAP 1. DISP DUP 3. DISP OBJ-
> 3. DUPN * UNROT * + UNROT * + 2. * ":A: " OVER + 7. DISP

\>>

reth

15. ## Re: HP 50g simple programming

On Oct 25, 1:10*pm, "John H Meyers" wrote:
> On Fri, 24 Oct 2008 18:46:26 -0500:
>
> > I have a HP 50g calculator, just want to write some simple program,
> > like input R, the program calculates the circle area;
> > input L, H, W, then the program can calculate the surface area, etc.

>
> All things representable by formulas can be calculated directly
> using the numeric solver (just as on the HP42S),
> and you can save a set of your own equations,
> then choose any one to solve (for any variable,
> not just calculating one particular variable from the others);
> for example, in RPN mode:
>
> 'A=\pi*R^2' 'CIRCA' STO
>
> 'A=(L*H+H*W+W*L)*2' 'BOXA' STO
>
> \<< "Choose formula" 9 TVARS 1 CHOOSE
> * { STEQ 30 MENU } IFT \>> 'MYEQS' STO
>
> The 'MYEQS' program chooses any formula in the current directory,
> then starts the menu-based solver (like that of the HP42S).
>
> You can also just start the form-based numeric solver
> (Right-shift NUM.SLV "Solve Equation")
> and choose an equation using the form,
> rather than using a program.
>
> A slight expansion of the 'MYEQS' program could permit
> navigating through a directory tree,
> as well as picking equations from a single directory.
>
> Solving equations like this
> will store additional variables named in the formulas,
> containing numeric data;
> when you no longer need to save any such variables,
> you can purge them all from the current directory,
> plus any left-over "current equation(s)" and solver data using:
>
> \<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO
>
> Numeric values with attached "units" (e.g. 3.2_cm)
> may be included in this "clean-up"
> by expanding the list of object types to { 0 13 28 }
>
> All of the above works in all HP48G/49G/50G series.
>
> [r->] [OFF]

what's these ' \ ' slashes in the codes mean ? I cna't find in the 50G
user guide.
example:

\<< "Choose formula" 9 TVARS 1 CHOOSE
{ STEQ 30 MENU } IFT \>> 'MYEQS' STO

\<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO

16. ## Re: HP 50g simple programming

Trigraphs represent calculator special characters

wrote in message
what's these ' \ ' slashes in the codes mean ? I cna't find in the 50G
user guide.
example:

\<< "Choose formula" 9 TVARS 1 CHOOSE
{ STEQ 30 MENU } IFT \>> 'MYEQS' STO

\<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO

17. ## Re: HP 50g simple programming

In article
kxbao@hotmail.com wrote:

> what's these ' \ ' slashes in the codes mean ? I cna't find in the 50G
> user guide.
> example:
>
> \<< "Choose formula" 9 TVARS 1 CHOOSE
> { STEQ 30 MENU } IFT \>> 'MYEQS' STO
>
> \<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO

They mark that what follows represents a special character which does
not appear in the ASCII alphabet.

"\<<" and "\>>" represent the symbols which look like "<<" and ">>" on
the hp50, and mark the beginning end ending of a program.

18. ## Re: HP 50g simple programming [backslashes]

On Sun, 02 Nov 2008 20:34:43 -0600:

> what's these '\' backslashes [e.g. \<< \>> ] in the codes mean?
> I can't find in the 50G user guide.

To represent 8-bit characters which have no universal symbols,
so as to appear the same to everyone using all text editors, browsers,
newsgroup readers, email, and to the calculator itself
(when using Kermit or other text file transfer software),
as well as being able to type the programs on all computer keyboards.

Complete explanation and chart at:

Import/export programs for emulators such as Emu48:

[r->] [OFF]

19. ## Re: HP 50g simple programming [backslashes]

> Import/export programs for emulators such as Emu48:

The above also imports and exports
between calculators and plain text files on SD cards
(which in turn may be stored or edited using computers).

[r->] [OFF]

20. ## Re: HP 50g simple programming [backslashes]

On Nov 3, 1:39 pm, "John H Meyers" wrote:
> > Import/export programs for emulators such as Emu48:

>
> The above also imports and exports
> between calculators and plain text files on SD cards
> (which in turn may be stored or edited using computers).
>
> [r->] [OFF]

On 50g user's guide page 679:

"Units coefficient" { { "S.I. units" 1}
{ "E.S. units" 1.486} } 1 CHOOSE >> --->„³ save to 'CHP1'

Running this program, system will highlight choose box 'S.I
Units' (1st choice)

If I select 'S.I. Units' result is s2 1
S1 1

If I select 'E.S. Units' result is s2 1.486
S1 1
I made a small change in this program,

"Units coefficient" { { "S.I. units" 1}
{ "E.S. units" 1.486} } 2 CHOOSE >> --->„³ save to 'CHP1'

Running this program, system will highlight choose box 'E.S
Units' (2nd choice)

If I select 'S.I. Units' result is s2 1
S1 1

If I select 'E.S. Units' result is s2 1.486
S1 1

It seems to me : the corresponding coefficient of the system unit
selected is put on stack 2 (s2)
But why in the two examples, the stack 1 (s1) always show number '1' ,
this confuse me..???