The Museum of HP Calculators

HP Forum Archive 11

[ Return to Index | Top of Index ]

Can you clear out the stack?
Message #1 Posted by joe on 20 Mar 2003, 8:53 a.m.

I read the page here that goes into showing the basics of RPN. I read about the stack and that is quite fascinating. In the example all the registers on the stack are loaded with numbers. Hitting 'clx' clears the display register, but all the other registers have data in them, right?

How do you 'clear' all the stacks? Is there ever a need to have to worry about that?

Sorry to be such a pain, this stuff is interesting!

joe

      
Re: Can you clear out the stack?
Message #2 Posted by Vieira, Luiz C. (Brazil) on 20 Mar 2003, 9:26 a.m.,
in response to message #1 by joe

Hi;

in some circumstances it's a good idea to clear the stack to avoid using "garbage" if you press a wrong key. If the stack is empty, you can enter any number and accidentaly press [+] that you have no trouble. This is valid only for RPN models. RPL ones (HP28/48/49) demand two existing operators. RPN stack is always there, and its contets when cleared are all zeroes.

HP67/97 do not have an specific stack clearing procedure. The HP55 clears the stack if you clear registers ([f][CLR] or [g][CL.R]). All voyagers, except the HP16C, have the stack contents cleared when you perform statistics registers clearing ([f]CLEAR[], where means sigma greek letter). The HP12C is particularly different because the [f] CLEAR[REGS] clears everything, including the stack. I am not quite sure, but [f]CLEAR[FIN] keeps stack contents.

Both HP41 and HP42 have the CLST, that is the only specific function to LCear STack contents in these models.

RPL models have CLEAR function that clears numbered-levels contents.

Hope this helps. If I forgot something, please forgive-me: almost every information I post here is written by heart, except when I mention page numbers... ;-)

Luiz C. Vieira - Brazil

      
Re: Can you clear out the stack?
Message #3 Posted by Richard Garner on 20 Mar 2003, 9:40 a.m.,
in response to message #1 by joe

I am doing this from memory, with only the 48GX in front of me. I'm not sure about the older models, pre 41C, but there is a command called CLST (Clear Stack) that will clear the stack. On the 41C/CV/CX do an XEQ {Alpha] CLST [Alpha], this can be assigned to a key if you plan to use it allot. I think on the 15C, it is a shifted key command left of the ENTER key. On the 42S, 28C/S, & 48S/G Series it is accessable from a menu.

Hope this helps.

Richard Garner

            
Re: Can you clear out the stack?
Message #4 Posted by R Lion on 20 Mar 2003, 10:04 a.m.,
in response to message #3 by Richard Garner

In the 15c, CLEAR SIGMA ( f GSB ) puts a O into statistic registers AND in the four stack levels.

Raul

                  
Re: Can you clear out the stack?
Message #5 Posted by Richard Parfitt (UK) on 20 Mar 2003, 10:43 a.m.,
in response to message #4 by R Lion

If you have a HP25 there is a clear stack command as I think there is on the HP45. On the 25 it's [f,clx], I think most of the classic machines that had a summation function also had clear stack capability because the summation made use of the stack. Quick way to check is to look at pictures of machines on MoHP site. Regards Richard.

                  
Re: Can you clear out the stack?
Message #6 Posted by Karl Schneider on 20 Mar 2003, 11:54 p.m.,
in response to message #4 by R Lion

"In the 15c, CLEAR SIGMA ( f GSB ) puts a O into statistic registers AND in the four stack levels."

Works for the real stack, but does not touch the imaginary stack if in complex mode. CLx, ENTER, ENTER, ENTER also fails to clear the imaginary stack, because CLx works only on the real X-register by design.

0, ENTER, ENTER, ENTER will clear both stacks.

CLEAR SIGMA, CF 8 will clear the real stack and eliminate the imaginary stack.

      
Clearing out the stack
Message #7 Posted by Nenad (Croatia) on 20 Mar 2003, 10:19 a.m.,
in response to message #1 by joe

Joe,

IMHO the reason why you need not worry about clearing the stack lies in the nature of the RPN itself. As you always see every intermediate result and the new argument pushes them up, you intuitivly know what will come down again.

Disregarding the RPL calculators (HP28, HP48, ...) only the HP42S shows the Y stack value in display, though, by my experience, this may sometimes be a bit confusing.

CLx is a very important operation, as it operates in a similar way ENTER does: disabling stack lift for the next enter argument. This is a trivial (but important) fact.

      
Re: Can you clear out the stack?
Message #8 Posted by joe on 20 Mar 2003, 10:57 a.m.,
in response to message #1 by joe

Thanks guys!

The more I read about all these things, the more I like them. I have allways been a fan of HP calculators and finding this site has been awesome.

Thank you again to all that have posted to my question.

joe

            
Re: Can you clear out the stack?
Message #9 Posted by Patrick on 20 Mar 2003, 3:19 p.m.,
in response to message #8 by joe

Then there's people like me who can't remember which clear function on which model does what. However, on just about any model you can clear the stack by pressing CLx, ENTER, ENTER, ENTER.

Quicker than spelling out CLST (or whatever it is called) on the 41's alpha display.

Not good for programming of course, but there you have an incentive to invest the time to do it right.

                  
Re: Can you clear out the stack?
Message #10 Posted by Vieira, Luiz C. (Brazil) on 20 Mar 2003, 4:57 p.m.,
in response to message #9 by Patrick

Hi;

that's exactly the way one find in the HP67 User's Manual, p. 80, bottom of page. As explained there, [f] [CL REG] does not change stack registers' contents.

And you're right: works in any RPN calculator.

Luiz C. Vieira - Brazil


[ Return to Index | Top of Index ]

Go back to the main exhibit hall