function %CH

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
Frank.upn
Posts: 6
Joined: Fri May 26, 2017 1:15 pm
Location: Germany

function %CH

Post by Frank.upn » Mon Sep 24, 2018 3:14 pm

Hello,

since I often need the function [%CH] I put these on a function key (with Assign - Custom).
Unfortunately, the function key [%CH] does not work.

for example:
500 ENTER
450 F1 [%CH]
>> -25

450 ENTER
500 F1 [%CH]
>> -25

it always comes the result "-25"

Everything is ok with [%CH] from the catalog menu
and also with free42 function key !

Am I doing something wrong ?
Is that only with my device?

regards
Frank

I use Google translation, sorry.

Dave Britten
Posts: 39
Joined: Wed Jun 14, 2017 7:27 pm

Re: function %CH

Post by Dave Britten » Mon Sep 24, 2018 3:44 pm

When I try your examples, I get -10 for the first one, and 11.111 for the second one.

Do you have a LBL named "%CH" that is causing a conflict? Try doing GTO "%CH". You should see "Label Not Found". If you do have a LBL "%CH", then I would recommend changing its name to avoid conflicts with the Custom menu.

Frank.upn
Posts: 6
Joined: Fri May 26, 2017 1:15 pm
Location: Germany

Re: function %CH

Post by Frank.upn » Mon Sep 24, 2018 4:14 pm

Think, that's the solution.

GTO "%CH" comes "label not found",
but I have loaded the program "Finance" and there is a label "%CHG" with sub-label "%CH".
There will be a conflict!

Many thanks for the help.

Thomas Okken
Posts: 484
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: function %CH

Post by Thomas Okken » Tue Sep 25, 2018 4:23 am

The %CHG routine creates a menu of variables (VARMENU) with an entry %CH, but as you saw, that is not a label, and so, it should not interfere with the %CH function in the CUSTOM menu. Just make sure you assign %CH in the CUSTOM menu, not %CHG, and when you want to use it, make sure you really are in the CUSTOM menu, not in the menu created by %CHG. You can tell the difference by pressing and holding the %CH menu key: the VARMENU item will show STO "%CH" or "%CH", while the function will show %CH.

User avatar
Walter
Posts: 771
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: function %CH

Post by Walter » Tue Sep 25, 2018 6:40 am

Thomas Okken wrote:
Tue Sep 25, 2018 4:23 am
You can tell the difference by pressing and holding the %CH menu key: the VARMENU item will show STO "%CH" or "%CH", while the function will show %CH.
Oh, the subtleties of this language ...
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

Frank.upn
Posts: 6
Joined: Fri May 26, 2017 1:15 pm
Location: Germany

Re: function %CH

Post by Frank.upn » Tue Sep 25, 2018 10:16 am

Addendum to the information (I hope google translates that correctly):
Thomas Okken wrote:
Tue Sep 25, 2018 4:23 am
... item will show STO "%CH" or "%CH", while the function will show %CH.
press and hold the custom menu button shows "%CH"

I did the following afterwards

1) deleted the %CH function in the Custom menu.
2) clear all programs in the calculator memory.
3) Added the %CH (!) Function in the Custom menu
holding down this key will show "%CH"
4) Clear Variable [CLV] %CH
5) Hold custom button [%CH] now shows %CH.
6) after loading Finance.raw, the Custom button still shows %CH
7) after using [XEQ] >> [%Calc] >> [%CHG] the Custom button will show "%CH" again

I'm not a programmer (just a calculator user), but I'm assuming that loading the finance program will affect the custom menu.

Is not a big problem for me, I delete the custom key [%CH] and use the financial program for the calculation.
Is more complicated, but ok :)

StreakyCobra
Posts: 4
Joined: Thu Jun 14, 2018 8:09 am

Re: function %CH

Post by StreakyCobra » Tue Sep 25, 2018 11:06 am

I tried – out of curiosity – if I can reproduce this and indeed the assigned key is changing from %CH to RCL "%CH" after a successful execution of %CALC » %CHG » %CH from the default "FINANCE.raw" program.

Thomas Okken
Posts: 484
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: function %CH

Post by Thomas Okken » Tue Sep 25, 2018 11:18 am

Frank.upn wrote:
Tue Sep 25, 2018 10:16 am
[...]
3) Added the %CH (!) Function in the Custom menu
holding down this key will show "%CH"
4) Clear Variable [CLV] %CH
5) Hold custom button [%CH] now shows %CH.
6) after loading Finance.raw, the Custom button still shows %CH
7) after using [XEQ] >> [%Calc] >> [%CHG] the Custom button will show "%CH" again

I'm not a programmer (just a calculator user), but I'm assuming that loading the finance program will affect the custom menu.
You are right; this is an aspect of the CUSTOM menu that I had completely forgotten about: when you assign a name to that menu, and a variable with that name exists, but not a label with that name, pressing the menu key performs a RCL.

You could fix the Finance program by changing the %CH variable name to something else, but I think the easiest fix would be to add a %CH program:

00 { 8-Byte Prgm }
01▸LBL "%CH"
02 %CH
03 END

This works because when there is a variable AND a program with the same name, the CUSTOM menu will pick the program.

(The CUSTOM menu only stores the literal text that you entered in the ASSIGN command; the determination of whether that text is interpreted as a label name, a variable name, or a built-in function, is made only when the menu key is pressed, not before, which is why the feedback from that key can change between %CH, RCL "%CH", and XEQ "%CH", without ASSIGN being performed in between.)

Post Reply