From Swordfish Wiki

Swordfish: FAQ

This sections covers some Swordfish Freqently Asked Questions (FAQ)...

I've suddenly started to have a problem with the WDT resetting my code. If I disable the WDT, then the program works fine.

You need to add a special compiler directive at the beginning of your main program before any include files. For example,

device = 18F452
clock = 20

#option WDT = true    // <- add before any includes...
include "usart.bas"
...

Just using the standard config directive 'WDT = ON' will only set the MCUs fuse. For example,

config
   OSC = HSPLL,
   BOR = ON,
   WDT = ON

include "usart.bas"
...

However, many Swordfish library calls are blocking or they may take quite some time to execute. To stop the WDT resetting the MCU, you have to 'tickle' it. By default, Swordfish libraries will not do this as it adds a little extra code overhead. However, including the directive

#option WDT = true

will do two things

Retrieved from https://www.sfcompiler.co.uk/wiki/pmwiki.php?n=Swordfish.FAQ
Page last modified on November 04, 2006, at 09:02 AM