The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Temporary User Mode Key Programs not working in RPN
Message #1 Posted by BruceTTT on 12 Oct 2013, 2:24 p.m.

Writing a program to define a user key assignment works in CAS for me, but does not seem to work in RPN/Home mode. If I write:

KEY K_Sq(A,B,C) BEGIN

RETURN {(-B+(B*B-4*A*C)^0.5)/(2*A),(-B-(B*B-4*A*C)^0.5)/(2*A)};

END;

the program works as expected in CAS, but putting 3 numbers on the stack in Home/RPN and doing 1U +/- does not run the app but just negates the level 1 item.

Ideas? Or is this a limitation of RPN mode?

Thanks for the discussion and comments.

      
Re: Temporary User Mode Key Programs not working in RPN
Message #2 Posted by Marcus von Cube, Germany on 12 Oct 2013, 2:54 p.m.,
in response to message #1 by BruceTTT

K_Sq assigns the x2 key, not +/-.

            
Re: Temporary User Mode Key Programs not working in RPN
Message #3 Posted by Tim Wessman on 12 Oct 2013, 3:05 p.m.,
in response to message #2 by Marcus von Cube, Germany

Indeed. The best way to make sure you did the right key is to use the little "Create User Key" helper which is found in the "menu" button while in the editor. [MENU][4] "Press any key..." and then press the one you want.

TW

                  
Re: Temporary User Mode Key Programs not working in RPN
Message #4 Posted by BruceTTT on 12 Oct 2013, 5:10 p.m.,
in response to message #3 by Tim Wessman

Sorry, I knew that. It doesn't work on either key. I tried two different keys and both had the same problem. I just posted the wrong copy of the code.

Still have the problem (on both keys :)), any ideas?

Bruce

Would someone try it and see if it works on your?

Edited: 12 Oct 2013, 5:11 p.m.

                        
Re: Temporary User Mode Key Programs not working in RPN
Message #5 Posted by Eddie W. Shore on 13 Oct 2013, 3:28 p.m.,
in response to message #4 by BruceTTT

I tried to do a similar code and can't get it to work in either RPN or Home Mode.

However, I can call a separate program with user keys.

EXPORT QUAD(A,B,C)
BEGIN
RETURN {0.5*(-B+sqrt(B^2-4*A*C))/A,
0.5*(-B-sqrt(B^2-4*A*C))/A};
END;

In a program file with user keys: KEY K_Sq() BEGIN RETURN "QUAD()"; END;

In RPN, press Shift + Help (User), x^2. Run QUAD(3) as QUAD uses 3 arguments.

                              
Re: Temporary User Mode Key Programs not working in RPN
Message #6 Posted by BruceTTT on 13 Oct 2013, 5:46 p.m.,
in response to message #5 by Eddie W. Shore

That works for me with the following caveats:

-- I can't use the K_Neg key, it only works on K_Sq (maybe others)
-- Don't know why I can't put the app in the K_Neg code, but doesn't work, you're correct
-- What do you *name* the program?
-- Do you have to Run the K_... program to install it?

Bruce

Edited: 13 Oct 2013, 5:47 p.m.

      
Re: Temporary User Mode Key Programs not working in RPN
Message #7 Posted by cyrille de Brébisson on 14 Oct 2013, 1:33 a.m.,
in response to message #1 by BruceTTT

hello,

a user key assignement can not take input parameters...

your function declaration should read: key K_Sq() begin ...

end;

cyrille

            
Re: Temporary User Mode Key Programs not working in RPN
Message #8 Posted by BruceTTT on 14 Oct 2013, 1:46 p.m.,
in response to message #7 by cyrille de Brébisson

Thanks. Any idea why this can't be assigned to the K_Neg key?


[ Return to Index | Top of Index ]

Go back to the main exhibit hall