FAQ
This sections covers some Swordfish Freqently Asked Questions (FAQ)...
- What is the future development plan for the compiler? For example, will Swordfish support any other PIC microcontrollers?
- I've suddenly started to have a problem with the WDT resetting my code. If I disable the WDT, then the program works fine.
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
- Automatically set the config 'WDT = ON'
- Link in the extra code needed to tickle the WDT, which will prevent the MCU from resetting