PIC16F917 stack issues


Results 1 to 7 of 7

Threaded View

  1. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Somehow, an interesting finding here for those using the MCS ICD.

    When you hit 'ICD Compile and program' button (or CTRL+F10), it create a variable named DEBUG_STACK which hold the value/actual level of the stack.

    NOW, to make things simple, just add those lines
    Code:
    @STACK_LEVEL = DEBUG_STACK
    STACK_LEVEL  VAR BYTE EXT
    And look what happen to your STACK_LEVEL variable in the ICD window while jumping here and there with gosubs.

    i used that one...
    Code:
    DEFINE LOADER_USED 1
    DEFINE OSC 20
    
    @STACK_LEVEL = DEBUG_STACK
    STACK_LEVEL  VAR BYTE EXT
    
    START:
        PAUSE 1000
        GOSUB LEVEL1
        GOTO START
        
    LEVEL1:
        PAUSE 1000
        gosub LEVEL2
        RETURN
        
    LEVEL2:
        PAUSE 1000
        GOSUB LEVEL3
        RETURN
    
    LEVEL3:
        PAUSE 1000
        gosub level4
        RETURN
    
    LEVEL4:
        PAUSE 1000
        RETURN

    WOOOOHOOOO! Don't break my bubble to me it's a nice finding... maybe usefull one day or another. Down side... it won't work unless you use the ICD... Darrel's stuff have a BIG advantage as you just need to read the StackPTR byte variable.
    Last edited by mister_e; - 18th February 2007 at 17:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Help With stack (STKPTR)
    By rickypatel in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th February 2008, 02:18
  2. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 10:04
  3. How do I drive 7 seg LCD with a PIC16f917
    By willemaajansen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd March 2007, 21:27
  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