Help With stack (STKPTR)


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Default Help With stack (STKPTR)

    im using the p18fx chips and im having a few problems

    i have no idea how to use the stack ... i need to split the stack into three and then make my three routines see independent fragment of the stack.

    any help is much appreciated....or links to tutorials

    Thank you kindly

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    There's usually no reason to manipulate the stack manually.

    What are you trying to do with 3 stack segments?
    <br>
    DT

  3. #3
    Join Date
    Feb 2008
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    well the task i have to complete requires me to use a stack..........we are getting to grips with how to use the pic and to use interrupts....so when a interrupt happens i wanna save the contexts of the WREG, STATUS and the BSR into each section of the stack. this is to be done with three different routines the ISR will run.......... i have done this by using MOVFF into registers but now i wanna use a stack

    Thanks

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Very strange assignment.
    Definitely not the way to do things.

    I can say, the only part of the stack that's available to read/write is the TOS (Top Of Stack).

    You can NOT split it in thirds and have 3 TOS's.

    To do what you are suggesting, you would need to create your own stacks in software, and POP the entries off the hardware stack, then put them in your own stacks. Then in reverse order, to pop them off your stack.

    But I really see no benefit, other than learning. And it's NOT beginners stuff.
    DT

Similar Threads

  1. PBP method to POP or PUSH to 18F2525 stack?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th September 2009, 20:09
  2. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 10:04
  3. Stkptr
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th March 2007, 20:50
  4. Stack Under flow
    By Wayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 14th September 2005, 13:22
  5. 48 level Software Stack
    By Darrel Taylor in forum Code Examples
    Replies: 0
    Last Post: - 30th November 2003, 01:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts