Post Reply 
Getting values from stack
10-28-2020, 07:06 PM
Post: #1
Getting values from stack
Hi to all
I'm new in HP PPL programming. I wrote a simple program that have as inputs two variables:
EXPORT myprog(value1,value2)
BEGIN
....
END

and it works fine. Running this program appears two edit box for variable insertion. How can I get these variables from stack ? That is I insert two values on stack and I want to give them as input to myprog.
regards
Find all posts by this user
Quote this message in a reply
10-28-2020, 08:47 PM (This post was last modified: 10-29-2020 10:35 PM by pinkman.)
Post: #2
RE: Getting values from stack
You cannot pick values on the stack like in RPL/RPN, but here are the ways to use previous values:

Textbook or Algebraic entry mode:
myprog(Ans(1), Ans(2))

RPN entry mode:
(Assume the two vals are the last on stack)
myprog(2)

This is only applicable in Home view. If you use the program list to run your program, use the Menu/Get from Home (or CAS) function:
Select the program myprog
Touch the Run soft key
Highlight the first field then touch the Edit soft key
When editing, press the Menu key
Select Get from Home (or CAS) then Enter
Chose the value.

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
10-28-2020, 10:47 PM (This post was last modified: 10-28-2020 10:53 PM by Stevetuc.)
Post: #3
RE: Getting values from stack
(10-28-2020 07:06 PM)Francesco Wrote:  Hi to all
I'm new in HP PPL programming. I wrote a simple program that have as inputs two variables:
EXPORT myprog(value1,value2)
BEGIN
....
END

and it works fine. Running this program appears two edit box for variable insertion. How can I get these variables from stack ? That is I insert two values on stack and I want to give them as input to myprog.
regards

Not exactly what you asked for, but you can directly access RPN stack levels in your program without passing them as parameters. So something like this will work if called from home screen with 2 values on the stack:

EXPORT myprog()
BEGIN
Ans(1)*Ans(2) // eg. return stack1 x stack2
END;

It also works in textbook and algebraic entry modes and when run from program catalog
Find all posts by this user
Quote this message in a reply
10-29-2020, 05:57 PM
Post: #4
RE: Getting values from stack
Hi Francesco,

you can!

Change HOME Settings > Entry to RPN

In HOME mode enter the input values in the order they are declared in your program.
e.g. EXPORT PROGRAM( INP1, INP2, ...)

INP1 ENTER
INP2 ENTER
...

Start the program via toolbox.
Leave the () blank.
Press ENTER.

Does not work when started from Program Catalog OR CAS mode!

Nevertheless, whatever Entry mode you'r in, starting from the toolbox will
provide PROGRAM() - () to be filled in accordingly - (INP1, INP2, ...) AND

starting from Program Catalog will always show the Entry Form.

Hope that helps.

regards
Stefan
Find all posts by this user
Quote this message in a reply
Post Reply 




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