SWDTEN troubles (16F1933)


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: SWDTEN troubles (16F1933)

    SWDTEN is bit 0 of WDTCON register.
    When using nap iorlw 1 and movwf WDTCON enables SWDTEN bit before sleep.
    And WDTCON is restored after sleep.

  2. #2
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: SWDTEN troubles (16F1933)

    Quote Originally Posted by pedja089 View Post
    SWDTEN is bit 0 of WDTCON register.
    When using nap iorlw 1 and movwf WDTCON enables SWDTEN bit before sleep.
    And WDTCON is restored after sleep.
    correct, SWDTEN is bit 0 of WDTCON, my usage of the term was not clear as SWDTEN is also the name one of the config settings for WDT, sorry about that

    the way i read everything in the data unless config1 <4:3> is set to allow SWDTEN then SWDTEN bit in WDTCON.0 is ignored

    this is from the data sheet for WDTCON
    WDTE is 2 bits in CONFIG1
    bit 0 SWDTEN: Software Enable/Disable for Watchdog Timer bit
    If WDTE<1:0> = 00:
    This bit is ignored.
    If WDTE<1:0> = 01:
    1 = WDT is turned on
    0 = WDT is turned off
    If WDTE<1:0> = 1x:
    This bit is ignored.

    this is what i cannot get to work correctly, have tried many things
    i can turn WDT hard ON or hard OFF in config and things work as expected, but when i set WDT to SWDTEN in config the SWDTEN bit of WDTCON does not work correctly,
    have tried setting it manually in parts of test code before and after NAP
    i can see the WDTCON.0 being of the expected state but WDT is not turning ON and OFF following the bit

    i think maybe NAP is not handling this chip correctly or maybe there is a bug in chip ?

    thanks for your patience in following up on this, maybe i have missed something you have said ?

    looking at the NAP ASM code it does not seem to know about the WDT config settings ? is that true ?

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: SWDTEN troubles (16F1933)

    It doesn't know... But relays on you to set WDT ON or to set WDT CONFIG to software control. If it is always on, then setting bit 0 doesn't have effect.
    If you set WDT to softvare control NAP will work as expected. It ALWAYS ENABLE WDT in WDTCON and wake up after while. If you disable WDT in CONFIG1, NAP stil enables bit 0 in WDTCON but it doesnt have effect. WDT will stay off and never wake up device.
    To wait for IOC, disable WDT in WDTCON, by reseting bit 0, and then use @ sleep to put device into low power mode.
    To wake up pic after while just use nap.
    I alredy wrote that at end of post #3.
    Last edited by pedja089; - 28th September 2014 at 20:55.

  4. #4
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: SWDTEN troubles (16F1933)

    I am off this project for a short while, but i will be back on it in a week or so and follow up as this topic interests me

    in the meanwhile i have done a workaround by setting CONFIG to WDT ON, then when it falls out of NAP i check IOC flag and i can tell if it timed out or got interrupted and act accordingly

    this burns a tiny bit more power than i had wanted (as it wakes up periodically) but i have big battery and i think it will be insignificant compared to self discharge

    pedja089, i will try your @ sleep suggestion when i start project again

Similar Threads

  1. 12F1822 troubles
    By Charlie in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2012, 12:53
  2. "symbol not previously defined" on 16F1933 - fuse issue i think
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd January 2011, 03:24
  3. Issue using DATA statement with 16F1933 in PBP2.60
    By bcd in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th August 2010, 01:36
  4. Troubles with I2C_Write
    By The Altruist in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 23rd March 2010, 23:57
  5. PIC16F676 Troubles
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th February 2005, 10:01

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