How to use PGMMENU & VARMENU

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
richmit
Posts: 28
Joined: Tue Feb 16, 2021 2:51 am

How to use PGMMENU & VARMENU

Post by richmit »

Hi,

I'm working on a program to select a MVAR function and a variable in the selected function -- i.e. I want to pick a function to plot and a an independent variable. I have two questions:

1) How can I display a prompt when PGMMENU is working? My code below just shows a blank line above the menu. I'm using free42 3.0.2

2) How can get the VARMENU-like behavior of the built in integration application -- i.e. where you press a variable and it is selected instead of the double press behavior used by the solver and VARMENU?

Code: Select all

LBL "PICF"
FUNC 01
EXITALL
"Pick Function"
AVIEW
PGMMENU 
STOP
ASTO "FUNC"
EXITALL
VARMENU IND "FUNC"
STOP
ASTO "IVAR"
EXITALL
"F: "
ARCL "FUNC"
├"("
ARCL "IVAR"
├")"
AVIEW
RTN
END
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: How to use PGMMENU & VARMENU

Post by Thomas Okken »

richmit wrote:
Thu Apr 01, 2021 8:35 pm
1) How can I display a prompt when PGMMENU is working? My code below just shows a blank line above the menu. I'm using free42 3.0.2
It looks like PGMMENU is clearing the display. That's a bug, it's not supposed to do that. But as a work-around, you can use AVIEW or PROMPT after PGMMENU.

(Update: Yep, there was a line in the PGMMENU logic that explicitly cleared the top row of the display. I don't know why I put that there; VARMENU doesn't do that, and neither should PGMMENU. I removed it and so PGMMENU will behave more reasonably in the next Free42 release.)
richmit wrote:
Thu Apr 01, 2021 8:35 pm
2) How can get the VARMENU-like behavior of the built in integration application -- i.e. where you press a variable and it is selected instead of the double press behavior used by the solver and VARMENU?
You can't. The "select" behavior only happens immediately after the STO behavior, so if you want to select a variable without storing any data, you have to press the menu key twice (which means you are storing something, just not overwriting anything important, hopefully).
Last edited by Thomas Okken on Fri Apr 02, 2021 12:06 am, edited 1 time in total.
whuyse
Posts: 198
Joined: Thu Dec 21, 2017 1:23 pm

Re: How to use PGMMENU & VARMENU

Post by whuyse »

Exactly. 42S behaviour..
See here: https://www.hpmuseum.org/forum/thread-16574.html for an example of the use of PGMMENU.
Cheers, Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
richmit
Posts: 28
Joined: Tue Feb 16, 2021 2:51 am

Re: How to use PGMMENU & VARMENU

Post by richmit »

Thomas & Werner;

Thank you!

A bug! How exciting. Usually when computers don't do what I want, I'm doing something wrong!

Flipping the order got me working -- didn't think about that because it is still strange to me that menu commands don't halt execution.

A VARMENU1 function that acted the way the integration variable menu works would be a neat feature.

Anyhow, here is a little program that will do sums & products, and works almost the same way the built in integration works. The log option computes the sum/product of the log of the values.

Code: Select all

LBL "PICF"
FUNC 01
EXITALL
PGMMENU 
"Pick Function"
AVIEW
STOP
ASTO "_EQ"
EXITALL
VARMENU IND "_EQ"
"Set Var; "
├"Pick Free Var"
AVIEW
STOP
ASTO "_EQX"
EXITALL
"F: "
ARCL "_EQ"
├"("
ARCL "_EQX"
├")"
AVIEW
RTN
END

LBL "PSUM"
CF 02              
XEQ "PICF"
LBL 01            @@@@ Page 1 of menu SSUM
CLMENU
"LLIM"
KEY 1 XEQ 02
"ULIM"
KEY 2 XEQ 03
"STEP"
KEY 3 XEQ 04
"LOG"
KEY 4 XEQ 07
FS? 02
"Σ ln"
FC? 02
"Σ"
KEY 5 XEQ 05
FS? 02
"π ln"
FC? 02
"π"
KEY 6 XEQ 06
KEY 9 GTO 00
MENU
STOP
GTO 01
LBL 00
EXITALL
RTN
LBL 02               @@@@ Action for menu key LLIM
STO "LLIM"
"LLIM: "
ARCL ST X
AVIEW
RTN
LBL 03               @@@@ Action for menu key ULIM
STO "ULIM"
"ULIM: "
ARCL ST X
AVIEW
RTN
LBL 04               @@@@ Action for menu key STEP
STO "STEP"
"STEP: "
ARCL ST X
AVIEW
RTN
LBL 07               @@@@ Action for menu key log
FS?C 02
RTN
SF 02
RTN
LBL 05               @@@@ Action for menu key SUM
SF 01
GTO 30
LBL 06               @@@@ Action for menu key PRODUCT
CF 01
GTO 30
LBL 30
@@@@ Default LLIM & STEP to 1 if unset
1
SF 25
RCL "LLIM"
FC?C 25
STO "LLIM"
SF 25
RCL "STEP"
FC?C 25
STO "STEP"
@@@@ Check for bad LLIM, ULIM, & STEP
RCL "LLIM"
RCL "ULIM"
X>Y?
GTO 31
"ERR: LLIM ≥"
├" ULIM"
AVIEW
RTN
LBL 31
RCL "STEP"
X>0?
GTO 32
"ERR: STEP ≤ 0"
AVIEW
RTN
LBL 32
@@@@ Sum/Prod it up
FS? 01
0
FC? 01
1
LSTO "SoP"
RCL "LLIM"
STO IND "_EQX"
LBL 33
CLA
ARCL "_EQX"
├"="
ARCL IND "_EQX"
AVIEW
1
SF 25
XEQ IND "_EQ"
FS?C 25
GTO 41
"ERR: Func Eval"
AVIEW
RTN
LBL 41
FC? 02
GTO 42
SF 25
LN
FS?C 25
GTO 42
"ERR: Bad Log"
AVIEW
LBL 42
FS? 01
STO+ "SoP"
FC? 01
STO× "SoP"
RCL "STEP"
RCL IND "_EQX"
+
STO IND "_EQX"
RCL "ULIM"
X≥Y?
GTO 33
RCL "SoP"
FS? 01
"SUM: "
FC? 01
"PROD: "
ARCL ST X
AVIEW
RTN
END

whuyse
Posts: 198
Joined: Thu Dec 21, 2017 1:23 pm

Re: How to use PGMMENU & VARMENU

Post by whuyse »

richmit wrote:
Fri Apr 02, 2021 1:34 am
A VARMENU1 function that acted the way the integration variable menu works would be a neat feature.
I second that!

Cheers, Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: How to use PGMMENU & VARMENU

Post by Thomas Okken »

Okay... it will be in 3.0.3 (and in the next Plus42 build, once I get the equation parser and evaluator done...)
whuyse
Posts: 198
Joined: Thu Dec 21, 2017 1:23 pm

Re: How to use PGMMENU & VARMENU

Post by whuyse »

Thanks Thomas, yet again!
Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
amafan
Posts: 87
Joined: Tue Sep 29, 2020 11:40 pm

Re: How to use PGMMENU & VARMENU

Post by amafan »

OP, I just tried running your code through the DM42 encoder and I got the following error message. "Invalid instruction 'FUNC 01' in line 01". I'm nowhere near being an expert in the DM42 software so I might be doing something wrong. Any ideas anyone?
DM42 (#6476), DM41X (#458), DM15, 12 - HP 12, 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 41CX, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
whuyse
Posts: 198
Joined: Thu Dec 21, 2017 1:23 pm

Re: How to use PGMMENU & VARMENU

Post by whuyse »

The encoder doesn't know the latest command enhancements in Free42 yet I'm afraid. FUNC, PGMMENU, LASTO, ...
You'll have to type those in by hand for now.
Cheers, Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
amafan
Posts: 87
Joined: Tue Sep 29, 2020 11:40 pm

Re: How to use PGMMENU & VARMENU

Post by amafan »

whuyse wrote:
Tue Apr 20, 2021 7:06 pm
The encoder doesn't know the latest command enhancements in Free42 yet I'm afraid. FUNC, PGMMENU, LASTO, ...
You'll have to type those in by hand for now.
Cheers, Werner
Oh, OK. I will try it that way after I update my firmware to the latest release. Should have thought of that.

Thanks so much.
DM42 (#6476), DM41X (#458), DM15, 12 - HP 12, 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 41CX, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
Post Reply