Interrupts and stack


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Interrupts and stack

    Can you post your code? You really should never gosub or goto out of an ISR. It just sets you up for bad hard to find problems. While I am not sure, I get the feeling you are using on interrupt. You can maybe get away with this in this case, but as you start using interrupts (DT_INT or ASM) this will cause you un known problems.

    As for the circular stack, that would just mask the problem. You code may appear to be working, but in fact may be doing lots of just looping willy-nilly until it finds the correct spot again.

    Remember even a broken clock is correct twice a day.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default Re: Interrupts and stack

    Hello Bert,

    Yes, you are right, I am using "ON INTERRUPT" and from the interrupt handler I accessed a subroutine placed outside. Putting "disable/enable" around that subroutine fixed the problem, but I will just copy that piece of code into the interrupt handler to avoid further problems. So far I am not ready to insert ASM code, so everything is in PICBasic.

    I like Charles idea to put stack value onto display in the beginning of the main loop to check if there is a problem. In my case I needed it in the interrupt handler (where I now have this value slightly above zero) but the test of the main loop for zero value is just great!

    Thanks, as usually you all are very helpful. Hope some day I will be able to help others too

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