Selective generation of clrwdt?


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521

    Default Selective generation of clrwdt?

    Hello everyone,

    As part of an interrupt service routine I have the following code:
    Code:
    If AnalyzeMode THEN
      If Trigger = 0 THEN
        If Trigged = 0 THEN
          Trigged = 1 
        ENDIF
      ENDIF
    ENDIF
    If my examination of the LST file is correct this particular section generates a total of 12 instructions, out of which 3 is CLRWDT. Because this is an ISR and because I really want it to run as fast as I possible I don't want to spend 25% (or more depending on how the statements evaluates) of the time kicking the dog.

    Is there a way to selectively turn off the insertion of CLRWDT, kind of like ENABLE DEBUG? I know you can DEFINE NO_CLRWDT 1 but that is a single shot thing and it would mean I either need to insert the CLRWDT manually (yuk) or kill the dog completely, which I'd prefer not to - if possible.

    In this particular case there are a CLRWDT inserted both before AND after this section so doing it up to three more times in just a couple of microseconds seems like quite a waste of time.

    Thanks!
    /Henrik.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi, Henrik

    The good question is :

    Do you really need the Watchdog to be enabled ??? ... as it's use is limited to SLEEP and NAP PbP commands ...

    In other words ... do you use those two commands in your Program ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,
    No, I'm not using Sleep or Nap. But as you know that's not only what the WDT is used for... However, AFIK the program has never locked up or anything like that so you may be right, perhaps I should simply kill it.

    I'm still interested in an alternative solution though if anyone else has an idea!

    /Henrik.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi, Henrik

    Could your test be replaced by :

    Code:
    If AnalyzeMode AND ! trigger THEN
        trigged = 1
    Endif
    Alain
    Last edited by Acetronics2; - 12th April 2010 at 19:38.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Yep, that only produces a single clrwdt. On the other hand it produces CALLs to both LNOT and LAND, so two calls = 4 cycles + whatever code is actually in the LNOT and LAND routines. All in all I think it'll be slower than the previous version - unfortunately.

    I know, I'm hard to please.... ;-)

    /Henrik.

  6. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Disassemble program, remove offending clrwdt commands, reassemble program.

Members who have read this thread : 1

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