MVAR vs INPUT

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
hsilop
Posts: 21
Joined: Thu Mar 14, 2019 12:35 am
Location: Canberra, Australia

MVAR vs INPUT

Post by hsilop » Thu Mar 14, 2019 6:50 am

I have only had my DM42 for 2 days. I have never owned a HP42S. I have several HP calculators including the HP15 and HP41CV. I have developed a good library of astrophysics programs on the 41. I found it's ability to display alphanumeric output very handy as most of my programs display the units after the numeric result to minimise confusion.

Early on I found the VARMENU and MVAR statements. These worked fine for my code but I found I could not access my memory variables ( I have a bunch of constants in named variables ) easily without exiting the program. So I switched to INPUT statements. This worked much better for me. I can now use RCL to recall values from names variables without interrupting the program. Sweet!

Much much better. Is there another method I don't know about ?

I have to say I am enjoying my time with the awesome machine. So much power and sophistication in such a tiny package!
DM42 SN: 03223

HP-25, HP-33C, HP-41CV, HP-46, HP-11C, HP-12C, HP-15C, HP-16C

User avatar
ijabbott
Posts: 126
Joined: Fri Dec 15, 2017 1:34 pm
Location: Manchester, UK

Re: MVAR vs INPUT

Post by ijabbott » Thu Mar 14, 2019 6:16 pm

hsilop wrote:
Thu Mar 14, 2019 6:50 am
Early on I found the VARMENU and MVAR statements. These worked fine for my code but I found I could not access my memory variables ( I have a bunch of constants in named variables ) easily without exiting the program. So I switched to INPUT statements. This worked much better for me. I can now use RCL to recall values from names variables without interrupting the program. Sweet!

Much much better. Is there another method I don't know about ?
Perhaps I have misunderstood your requirements, but if the (named) variable you want to access isn't shown in the program's VARMENU, you should still be able to access it via [SHIFT] [CATALOG] and then the [REAL], [CPX] or [MAT] soft button. (Or you can type the name from the ALPHA menu.)

(This thread doesn't really belong in the Software Library forum. Perhaps a friendly moderator can move it.)

hsilop
Posts: 21
Joined: Thu Mar 14, 2019 12:35 am
Location: Canberra, Australia

Re: MVAR vs INPUT

Post by hsilop » Thu Mar 14, 2019 9:01 pm

I will try that. Still very new to this calculator coming from a HP-41CV. Never used a HP-42S before.

Thanks.
DM42 SN: 03223

HP-25, HP-33C, HP-41CV, HP-46, HP-11C, HP-12C, HP-15C, HP-16C

User avatar
pica
Posts: 27
Joined: Fri Mar 30, 2018 9:36 am
Location: eSwatini

Re: MVAR vs INPUT

Post by pica » Sat Mar 16, 2019 5:11 am

Again, I'm not sure exactly what the problem is, but keep in mind that even if there is an MVAR statement in your program, the variable does not actually exist until something is stored in it. When writing programs, it is best to store a number- usually I put zero- into each variable before starting. It will then appear in variable lists. In my mind the INPUT statement is there mostly for backwards compatibility with the HP41. The MVAR system is generally way cooler.

Thomas Okken
Posts: 528
Joined: Tue May 02, 2017 3:48 pm
Contact:

Re: MVAR vs INPUT

Post by Thomas Okken » Sat Mar 16, 2019 9:30 am

No, hsilop is referring to the way the menu behaves when VARMENU is active. Normally, STO and RCL will show a menu with all the currently existing variables, but while VARMENU is active, you get that menu instead.

For example, say you start from the Memory Clear state, and you enter a program with

Code: Select all

01 LBL "FOO"
02 MVAR "A"
03 MVAR "B"
04 MVAR "C"
05 [...]
Now, when you execute VARMENU "FOO", you'll get a menu with the items A, B, and C. Press STO, and you will still see a menu with the items A, B, and C; you will not see any of the other existing variables, like, in this case, REGS.

If you want to access one of those other variables, this is a bit annoying, since you'll have to either spell out its name, or EXIT out of the VARMENU before pressing STO in order to get the usual menu showing all existing variables. Or press ENTER CATALOG and then REAL, CPX, or MAT to get the catalogs of real scalars, complex scalars, or matrices, respectively, which takes four extra keystrokes and has the disadvantage of not showing all the variables at once, regardless of type.

Using INPUT avoids all this, but of course it has other drawbacks, like imposing a rigid sequence of assignments while VARMENU doesn't.

(BTW, INPUT is not an HP-41 function. It was introduced on the 42S.)

User avatar
pica
Posts: 27
Joined: Fri Mar 30, 2018 9:36 am
Location: eSwatini

Re: MVAR vs INPUT

Post by pica » Sat Mar 16, 2019 12:52 pm

OK. Thanks for the clarification. I had never even tried to STO or RCL a global variable with a menu open. I would just put in menu items for all the constants I might need, and then RCL and STO will work fine. Although STO is not needed to store into a menued variable. You are not limited to 6 variables in the menu, as you can scroll down if there are more. It is also not hard to get the DM42 to display an answer with alpha embellishments by using ARCL to append a numeric answer to the alpha register and then use AVIEW or PROMPT to display.

It is Interesting that the HP41 did not have INPUT at all. I used it a lot with the HP33 and HP35s, but find the menuing capabilities of the HP42 so much more flexible.

Post Reply