Processor halts : Please help


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jerson View Post
    Hi cwmaddy

    I've browsed through your code. You code quite well and this will take a little time to understand. However, from your problem descriptions, it looks like you are having some stack related issues. That is why you find the serout repeating without reason. The random hanging also indicates a stack failure. I suggest you check on the nesting levels.
    gosub getprogcode no return
    gosub error1 no return
    gosub execute, if true bypass return
    gosub lowrel no return
    stack fills up, hang.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Jul 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies.I shall try to go through code and correct it as per your suggestions I am sorry for the commented and dead code in the file. I shall try to put cleaner code next time.

  3. #3
    Join Date
    Jul 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Another thing to note is, program hangs before even reaching to the points of code suggested where stack overflow might occur.
    getProgCodes is subroutine and returns with normal return at all execution instances
    same is the case with execute

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cwmaddy View Post
    Another thing to note is, program hangs before even reaching to the points of code suggested where stack overflow might occur.
    getProgCodes is subroutine and returns with normal return at all execution instances
    same is the case with execute
    Hello cwmaddy, Debugging code is much like killing ants, you may not notice just 1, get a bunch and they start to stand out. Where does the program hang ? I like to hook up a serial lcd on an unused pin and put serout/debug markers in my code to find the last routine executed properly. I remove them when the code executes properly. You have nearly 2300 opportunities for a hang in this code, it is a very large program.
    Last edited by Archangel; - 5th August 2009 at 18:10.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Jul 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Hello,

    Thanks for reply
    I agree with you in case of debugging firmware
    I have put serout statements in the program . Program jumpts to unknown place/starts printing serouts from another routine, when I repeatedly press the pickup-hangup switch. Otherwise execution is normal

    cwmaddy

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cwmaddy View Post
    Hello,

    Thanks for reply
    I agree with you in case of debugging firmware
    I have put serout statements in the program . Program jumpts to unknown place/starts printing serouts from another routine, when I repeatedly press the pickup-hangup switch. Otherwise execution is normal

    cwmaddy
    Do you have any sub routines that are called with goto and gosub? What I am thinking: you wrote subroutines with the expectation of return sending program back to the line after gosub, and if you send it with a goto it will run right past the return because there is no location in the stack to return to. Just a thought . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    cwmaddy,

    I think your biggest problems are in the Interrupts.

    1) You've only created 1 wsave variable. But there should be 1 for each bank of ram, usually at addresses $20,$A0,$120 and $1A0.

    The PIC cannot change banks before saving the W reg., because that would change W reg. So it has to be saved in whichever bank is currently selected when the interrupt occurs.

    Without the other wsave variables, the ISR will be saving and restoring the wrong values, and could be overwriting other variables that have nothing to do with the ISR.

    2) Even worse. You're using Basic language statements inside ASM type interrupts, which will corrupt PBP's system variables and can cause just about anything to happen, including jumping to routines that aren't supposed to be running. It also causes other variables to be overwritten with random values, which just causes more random actions.

    If you want to use Basic language statements in your ASM interrupts, the easiest way to do it is ...

    DT_INTS - Instant Interrupts
    http://www.darreltaylor.com/DT_INTS-14/intro.html

    hth,
    DT

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