Stack Under flow


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Hernando,Florida USA
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Mplab Sim

    Hi Steve
    You only get the error if you use the MPLAB SIM tool or program the PIC
    and install it in the board.


    Thanks
    Wayne

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


    Did you find this post helpful? Yes | No

    Default

    So to be clear does
    Code:
    main:
    GoSub getkey
    Goto Start     ' <=== Add this line
    
    getkey:
    kp1=0 'Clear kp1
    fix the problem... i guess yes !?!
    Steve

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

  3. #3
    Join Date
    Sep 2005
    Location
    Hernando,Florida USA
    Posts
    8


    Did you find this post helpful? Yes | No

    Talking stack under flow

    Hi Steve (MR. E)

    Yes that did work and thank you very much for the help.
    But one more thing WHY and what is a stack underflow?

    Again Thanks

    Wayne

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


    Did you find this post helpful? Yes | No

    Default

    A short explanation:
    once the program RETURN from GETKEY, it RETURN after the GOSUB line, then do once again the GETKEY sub, meet a RETURN without a previous gosub.

    Gosub => stack+1 => stack = +
    Return => stack-1 => stack = 0
    Return +> stack-1 => stack=-1 <=== here's the underflow
    Steve

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

  5. #5
    Join Date
    Sep 2005
    Location
    Hernando,Florida USA
    Posts
    8


    Did you find this post helpful? Yes | No

    Smile stack underflow

    OK makes sence


    Again Thanks for your help




    Wayne

Similar Threads

  1. Hall Effect flow meter with 16F876
    By revelator in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th March 2010, 20:42
  2. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 10:04
  3. Stack over flow with IF THEN RETURN ENDIF???
    By kdoske in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th December 2007, 17:20
  4. hot water flow sensor
    By jessey in forum Off Topic
    Replies: 16
    Last Post: - 24th January 2007, 04:05
  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