HP50g R/S key - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: HP50g R/S key (/thread-13211.html) HP50g R/S key - Neve - 06-30-2019 01:31 PM Hi, I’m more used to using my HP41 than any other calculator, and I’ve always found that running programs which prompt you for input to be very uncomfortable on the HP50g. On the 41 you just input your data and hit the R/S key. On the 50g you need to perform an extra step (Left Shift—>Cont). Is there a more convenient and more confortable way? Thank You RE: HP50g R/S key - grsbanks - 06-30-2019 01:50 PM The general idea with RPL is that you provide all the data that your program will need on the stack before running it, so no prompt is needed. Alternatively you can create and use menus in your program. Either way round, no R/S key is needed. CONT is used more for debugging. You stop a program's execution with HLT so you can look at the stack and whatever variable you need to examine and then resume execution with CONT. RE: HP50g R/S key - Neve - 06-30-2019 01:58 PM (06-30-2019 01:50 PM)grsbanks Wrote:  The general idea with RPL is that you provide all the data that your program will need on the stack before running it, so no prompt is needed. Alternatively you can create and use menus in your program. Either way round, no R/S key is needed. CONT is used more for debugging. You stop a program's execution with HLT so you can look at the stack and whatever variable you need to examine and then resume execution with CONT. I see... Less convenient and longer either way it would seem (to me)... RE: HP50g R/S key - Neve - 06-30-2019 02:01 PM (06-30-2019 01:58 PM)Neve Wrote:   (06-30-2019 01:50 PM)grsbanks Wrote:  The general idea with RPL is that you provide all the data that your program will need on the stack before running it, so no prompt is needed. Alternatively you can create and use menus in your program. Either way round, no R/S key is needed. CONT is used more for debugging. You stop a program's execution with HLT so you can look at the stack and whatever variable you need to examine and then resume execution with CONT. I see... Less convenient and longer either way it would seem (to me)... How do you store that data beforehand? Wouldn’t that be more of a hassle? Simpler to do it within the program like on the 41. Or maybe I’m not used to doing it that way... RE: HP50g R/S key - grsbanks - 06-30-2019 02:15 PM (06-30-2019 02:01 PM)Neve Wrote:  How do you store that data beforehand? Wouldn’t that be more of a hassle? Simpler to do it within the program like on the 41. Or maybe I’m not used to doing it that way... What do you mean by "store"? You just type the data into the stack and let your program loose on it. For example, to calculate the volume of a sphere of height $$h$$ and radius $$r$$, $$v={\pi}r^2h$$, you would enter $$h$$ and then $$r$$ onto the stack and run a program like this on them: Code: « → h r « r SQ π * h * →NUM » » RE: HP50g R/S key - Neve - 06-30-2019 02:33 PM (06-30-2019 02:15 PM)grsbanks Wrote:   (06-30-2019 02:01 PM)Neve Wrote:  How do you store that data beforehand? Wouldn’t that be more of a hassle? Simpler to do it within the program like on the 41. Or maybe I’m not used to doing it that way... What do you mean by "store"? You just type the data into the stack and let your program loose on it. For example, to calculate the volume of a sphere of height $$h$$ and radius $$r$$, $$v={\pi}r^2h$$, you would enter $$h$$ and then $$r$$ onto the stack and run a program like this on them: Code: « → h r « r SQ π * h * →NUM » » I mean what if you need to reuse these same data again within the program. If they’re stored (STO) you can recall them at will (RCL), still within the program. Quite simple on a 41. Or maybe I don’t get the logic behind the 50g. RE: HP50g R/S key - grsbanks - 06-30-2019 02:41 PM Then you use local variables in your program like I did above. RE: HP50g R/S key - Neve - 06-30-2019 02:56 PM (06-30-2019 02:41 PM)grsbanks Wrote:  Then you use local variables in your program like I did above. Yes, I get that. But what if you WANT/NEED to be prompted for data entry? Like in this simple HP41 program. RE: HP50g R/S key - grsbanks - 06-30-2019 03:05 PM "Want" and "need" are not the same. If you "want" to do things the "keystroke programming" way on a machine that provides you with a structured language then that's your decision, but you're making life difficult for yourself. However, you don't "need" to prompt for input in a program that's a port to the 50g of your 41C program. The values prompted for in lines 3, 6, 9, 12 and 15 of your 41C program would be entered into the stack before you run the program. The program would take those values from the stack, place them in local variables and use those local variables to do the calculation. RE: HP50g R/S key - BruceH - 06-30-2019 04:11 PM (06-30-2019 02:56 PM)Neve Wrote:  But what if you WANT/NEED to be prompted for data entry? The INPUT command displays a prompt string; the user then enters the value on the command line; and presses ENTER to submit it and continue the program. If there are several values required at once then the INFORM command can be used to create an input form. For fixed choices from a predefined (or precalculated) list then there is the CHOOSE command. A common technique is to write a function that accepts its parameters from the stack so that it can easily be called from within a larger program, but use an input form as a wrapper for when it is called on its own and you want a reminder of what the parameters are. RE: HP50g R/S key - Neve - 06-30-2019 04:13 PM (06-30-2019 04:11 PM)BruceH Wrote:   (06-30-2019 02:56 PM)Neve Wrote:  But what if you WANT/NEED to be prompted for data entry? The INPUT command displays a prompt string; the user then enters the value on the command line; and presses ENTER to submit it and continue the program. If there are several values required at once then the INFORM command can be used to create an input form. For fixed choices from a predefined (or precalculated) list then there is the CHOOSE command. A common technique is to write a function that accepts its parameters from the stack so that it can easily be called from within a larger program, but use an input form as a wrapper for when it is called on its own and you want a reminder of what the parameters are. Thank you. I’ll try that too. RE: HP50g R/S key - DavidM - 06-30-2019 04:43 PM (06-30-2019 02:56 PM)Neve Wrote:  ...Like in this simple HP41 program. Bruce responded with the "INPUT" suggestion before I could finish my post . Here's a sample of how that might look: Code: «    "HITS?" "" INPUT STR→    "WALKS?" "" INPUT STR→    "HIT-PITCH?" "" INPUT STR→    "AT BAT?" "" INPUT STR→    "SAC FLY?" "" INPUT STR→    → hits walks hitpitch atbat sacfly    «       hits       walks       +       hitpitch       +       ...    » » Entering the values is a simple matter of pressing the numeric keys needed followed by ENTER, after which the program automatically continues (no need for CONT). The values left on the stack by that series of INPUT steps are then stored in local variables which are then accessible by name in the subsequent « ... » block. I believe this type of construct provides similar functionality to the 41 code you listed. Instead of pressing R/S after entering the values, you simply press ENTER. The INPUT command has more overhead than PROMPT, but that's needed to support the different object types and to allow for additional processing if needed based on the contents of what was entered. RE: HP50g R/S key - Neve - 06-30-2019 05:33 PM (06-30-2019 04:43 PM)DavidM Wrote:   (06-30-2019 02:56 PM)Neve Wrote:  ...Like in this simple HP41 program. Bruce responded with the "INPUT" suggestion before I could finish my post . Here's a sample of how that might look: Code: «    "HITS?" "" INPUT STR→    "WALKS?" "" INPUT STR→    "HIT-PITCH?" "" INPUT STR→    "AT BAT?" "" INPUT STR→    "SAC FLY?" "" INPUT STR→    → hits walks hitpitch atbat sacfly    «       hits       walks       +       hitpitch       +       ...    » » Entering the values is a simple matter of pressing the numeric keys needed followed by ENTER, after which the program automatically continues (no need for CONT). The values left on the stack by that series of INPUT steps are then stored in local variables which are then accessible by name in the subsequent « ... » block. I believe this type of construct provides similar functionality to the 41 code you listed. Instead of pressing R/S after entering the values, you simply press ENTER. The INPUT command has more overhead than PROMPT, but that's needed to support the different object types and to allow for additional processing if needed based on the contents of what was entered. Oh I see, thanks. I’ll try playing with these commands. I guess I just like the “simplicity” of how the 41 behaves and try to replicate that in the 50g.