Unexpected PIC reset (probably when byte variable overflows)


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Unexpected PIC reset (probably when byte variable overflows)

    Turning off the watchdog makes it work so that's what's resetting it for sure...

    The original code, where I notices it is like this:
    Code:
    Main:
      i = i + 1
      Gosub GetValue
      PortB = Out
    Goto Main
    Then the subroutine GetValue is a lookuptable with 255 entries returning the value in Out. It too restarts when the dog is unleashed. However, if I add IF i = 255 then i = 0 at the end it works. I then tried to boil that down to the minimum, which is what I posted above.

    So, is this an oversight on my behalf or an unwated side effect of a "tight" (it's not THAT tight) program?

    In any case, thanks Bruce!
    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Unexpected PIC reset (probably when byte variable overflows)

    How your lookup table looks like?

    I could be wrong but probably the generated asm for the IF/THEN have some CLRWDT while the lookup don't?
    Steve

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

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405

    Default Re: Unexpected PIC reset (probably when byte variable overflows)

    It sounds to me like PBP does not reset WDT for all instances. I.E. if you have only a simple loop, incrementing or decrementing a variable, with no PBP commands in the loop, you have a WDT reset.

    PBP will reset WDT in most command routines, but with something so simple, without any PBP library routines invoked, it may not be resetting WDT!

    And - why the heck did this reply end up as the 1st post magically? It was posted after post #6?
    Last edited by Bruce; - 2nd September 2011 at 21:36.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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