Hi there,
Does CLEAR command clear the return address of a subroutine on the stack ?
Thanks.
===============================
Hi there,
Does CLEAR command clear the return address of a subroutine on the stack ?
Thanks.
===============================
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
No - the stack space is not part of the data space. Just your defined variables and PBP (internal) defined variables are cleared.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Thanks Paul.
Other then hard reset, how do I clear return adresses?
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I haven't tried it myself...but...
Looking thru the datasheet for the 18F4620, I see:
TOSU, TOSH, TOSL (top of stack, upper, high, low) and the STKPTR register. Looks like the contents of STKPTR are Read/Write. So, in theory, you should be able to decrement the value in the low 5 bits of STKPTR and thereby 'POP' the last 'PUSH' off the stack.
SAYZER,
On 16 bit devices (e.g., 18F), you can reset the STKPTR = 0 to "clear" all the addresses on the stack. The values really are not cleared - but the stack pointer points to the first location (0) and does not know about the "old" values. You could actually clear them if you wanted as Ski noted but the pointer tells the PIC where to place and get stack data.
On 14 or lesser bit devices (e.g., 16F or lesser), you cannot clear the Stack (it is a circular buffer and does not reside in program or data space).
NOTE: you must be very careful messing with the Stack because behind the scenes, PBP uses it!
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks