Searching \ for 'where IS the stack described in TOS physically sto' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=where+stack+described
Search entire site for: 'where IS the stack described in TOS physically sto'.

Truncated match.
PICList Thread
'where IS the stack described in TOS physically sto'
1998\11\27@151053 by Jochen Feldhaar

flavicon
face
Hello piclisters,

I just subscribed to the list some days ago, as I will be starting on a PIC
programming project as part of my work. Normally, I am a high-frequency
guy.
Being new to the PIC I discovered the CALL will increase the top-of-stack
(TOS) to store the return address. As I know from earlier projects, it is
easy to destroy this information if the register containing the stack
values are overwritten. Therefore, I would like to know WHERE the return
infos are written to the register bank. I read the PIC manual (12C508), but
I have been sleeping or the information is not in the file (even I find
that hard to imagine).
So please tell me where I went wrong, and - more important - how many CALLs
can be done in a 12C508 until the stack will overflow.

TIA

Jochen DH6FAZ

1998\11\27@183343 by Henry Carl Ott

picon face
At 10:33 AM 11/27/98, you wrote:
>Hello piclisters,

>Being new to the PIC I discovered the CALL will increase the top-of-stack
>(TOS) to store the return address. As I know from earlier projects, it is
>easy to destroy this information if the register containing the stack
>values are overwritten. Therefore, I would like to know WHERE the return
>infos are written to the register bank. I read the PIC manual (12C508), but
>I have been sleeping or the information is not in the file (even I find
>that hard to imagine).
>So please tell me where I went wrong, and - more important - how many CALLs
>can be done in a 12C508 until the stack will overflow.
>


  Hi,
As far as I know the stack in all PICs is implemented entirelly in
hardware (okay I guess everything in the pic is implemented in hardware).
You may not access the stack pointer or stack data, either intentionally or
by accident. Only calls and returns manipulate the stack.

The stack is first in first out and you can overload the stack. Do to many
calls and the oldest return address gets lost.

The 12 bit core devices (12c508) have a two level stack (god, I wish this
was four)
and the 14 bit core devices have an eight level stack.

And note, I'm not sure how the stack behaves on some of the higher end parts.

So, the answer to your question on the 12c508 is two.

carl

--------------------------------------------------------
Henry Carl Ott   N2RVQ    spam_OUTcarlottTakeThisOuTspaminterport.net
http://www.interport.net/~carlott/
--------------------------------------------------------
BOIL that dust speck! BOIL that dust speck!

1998\11\27@190429 by Harold M Hallikainen

picon face
On Fri, 27 Nov 1998 10:33:13 +0100 Jochen Feldhaar <.....jfeldhaaKILLspamspam@spam@DETEKTOR.DE>
writes:
>
>Being new to the PIC I discovered the CALL will increase the
>top-of-stack
>(TOS) to store the return address. As I know from earlier projects, it
>is
>easy to destroy this information if the register containing the stack
>values are overwritten. Therefore, I would like to know WHERE the
>return
>infos are written to the register bank. I read the PIC manual
>(12C508), but
>I have been sleeping or the information is not in the file (even I
>find
>that hard to imagine).



       You're right!  It isn't there!  The PIC is interesting in that there's a
CODE memory map, a "file register" map that includes I/O and user RAM,
and a separate hardware stack.  So, you can't get there from here!  After
working with other processors, it took me a while to get used to register
file 0x20 not being the same as program location 0x20.
       I don't know about the chip you're using (but the data SHOULD be in the
book), but a 16c74a has 4 stack locations, as I recall.  After that, it
wraps around, really making a mess of things.  This gets me into trouble
when I try to do nice encapsulated programs using subroutine calls, then
it crashes when the interrupt causes a stack overflow.


Harold


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1998\11\27@211016 by Dwayne Reid

flavicon
face
>Hello piclisters,
>
>I just subscribed to the list some days ago, as I will be starting on a PIC
>programming project as part of my work. Normally, I am a high-frequency
>guy.
>Being new to the PIC I discovered the CALL will increase the top-of-stack
>(TOS) to store the return address. As I know from earlier projects, it is
>easy to destroy this information if the register containing the stack
>values are overwritten. Therefore, I would like to know WHERE the return
>infos are written to the register bank. I read the PIC manual (12C508), but
>I have been sleeping or the information is not in the file (even I find
>that hard to imagine).
>So please tell me where I went wrong, and - more important - how many CALLs
>can be done in a 12C508 until the stack will overflow.

You have 2 levels of stack on a 12c508 / 12c509 (or on any 12 bit core
part).  The stack is NOT a part of working RAM; you have no access to it
other than automatically pushing the return address when you CALL and
automatically popping when you RETURN.

Other parts (14 bit core) have 8 levels of hardware stack.

dwayne


Dwayne Reid   <dwaynerspamKILLspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(403) 489-3199 voice     (403) 487-6397 fax

1998\11\29@144815 by uter van ooijen / floortje hanneman

picon face
Most (all?) PICs have a dedicated stack, which is (sadly) not adressable in
any other way.
Tough luck for anyone who wants to write an interrupt driven  task
switcher, but you don't need
to worry about overwriteing the stack contents. But you do have to worry
about overflowing the
stack, which is only 2 levels on a 12c508.
Wouter.

----------
> From: Jochen Feldhaar <.....jfeldhaaKILLspamspam.....DETEKTOR.DE>
> To: EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU
> Subject: where IS the stack described in TOS physically stored?
> Date: Friday, November 27, 1998 10:33
>
> Hello piclisters,
>
> I just subscribed to the list some days ago, as I will be starting on a
PIC
> programming project as part of my work. Normally, I am a high-frequency
> guy.
> Being new to the PIC I discovered the CALL will increase the top-of-stack
> (TOS) to store the return address. As I know from earlier projects, it is
> easy to destroy this information if the register containing the stack
> values are overwritten. Therefore, I would like to know WHERE the return
> infos are written to the register bank. I read the PIC manual (12C508),
but
> I have been sleeping or the information is not in the file (even I find
> that hard to imagine).
> So please tell me where I went wrong, and - more important - how many
CALLs
> can be done in a 12C508 until the stack will overflow.
>
> TIA
>
> Jochen DH6FAZ

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...