SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop


+ Reply to Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    I was testing a new breadboard layout and PIC config; to make sure I had a heartbeat before piling more code.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,143


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    Since on power up the SEN bit of the WDTCON0 register is at 0 (Watchdog disabled), why does that chip resets itself?

    Ioannis

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    Because if the WDTE bits in CONFIG3 is anything but 0b01 the SEN bit is ignored and the CONFIG block of the code contains _WDT_ON which, according to the .INFO file for the device means
    Code:
     _WDTE_ON	    ;WDT enabled regardless of sleep; SWDTEN ignored
    If you want software control of the WDT you could choose
    Code:
    _WDTE_SWDTEN	    ;WDT enabled/disabled by SWDTEN bit in WDTCON0
    /Henrik.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,143


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    But then I see no way that PBP is aware of that or can reset the WDT.

    Ioannis

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    Quote Originally Posted by Ioannis View Post
    But then I see no way that PBP is aware of that or can reset the WDT.

    Ioannis
    I would guess by this bit?

    When the WDTE bits of Configuration Words are set to ‘01’, the WDT is controlled by the SEN bit of the WDTCON0 register.

    (p. 163 of datasheet)
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    Basically the CONFIG settings allows you to force the WDT either on/off OR allow the program to turn it on/off at runtime.

    As for resetting/clearing it, as long as you don't DEFINE NO_CLRWDT 1 PBP will clear/reset the WDT by inserting CLRWDT instructions into the code - it doesn't matter if the WDT is actually enabled, disabled, running or not. The instructions will be embedded in the assembly listing of the program. Unless, apparently, you do this kind of super tight loop.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,143


    Did you find this post helpful? Yes | No

    Default Re: SOLVED - PIC seems to RESET unless I add a PAUSE in Mainloop

    Does it matter if it is a tight loop in PBP? If it was in assembly I could understand, but in Basic? Seems like a bug.

    Ioannis

Similar Threads

  1. Unsupported new PIC 16F18015 - how to add?
    By wjsmarine in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th May 2023, 11:24
  2. Outside the Mainloop
    By pescador in forum General
    Replies: 10
    Last Post: - 26th April 2016, 17:34
  3. Replies: 6
    Last Post: - 28th October 2014, 06:08
  4. pic reset sometimes
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 23rd January 2008, 17:27
  5. Pic - reset
    By jrt4fun in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 19th September 2006, 19:12

Members who have read this thread : 12

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