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: 70
Joined: Thu Mar 14, 2019 1:35 am
Location: Canberra, Australia

MVAR vs INPUT

Post by hsilop »

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!
Steve

DM32 SN: 00316
DM41X SN: 00854
DM42 SN: 03223


HP11C, HP12C, HP15C, HP16C, HP25, HP32S, HP33C, HP41CV, HP46, HP65
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: MVAR vs INPUT

Post by ijabbott »

hsilop wrote:
Thu Mar 14, 2019 7: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: 70
Joined: Thu Mar 14, 2019 1:35 am
Location: Canberra, Australia

Re: MVAR vs INPUT

Post by hsilop »

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

Thanks.
Steve

DM32 SN: 00316
DM41X SN: 00854
DM42 SN: 03223


HP11C, HP12C, HP15C, HP16C, HP25, HP32S, HP33C, HP41CV, HP46, HP65
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: MVAR vs INPUT

Post by pica »

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.
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: MVAR vs INPUT

Post by Thomas Okken »

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: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: MVAR vs INPUT

Post by pica »

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.
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
Post Reply