Softools WinIDE Tips

Porting DC code:

Add the following includes:

#include "rabbit.h" // ports and global variables
specific to the rabbit
#include "dcdefs.h" // this will allow you to use many
of the DC function (i.e WrPortI())
These will port many of the DC macros and variables to Softools.

In your main() routine you will need:

WDT_DISABLE();
ipset0();

That will disable the watchdog timer and enable interrupts.
You will also probably need a startTimer() call if you need to
use MS_TIMER.

Each of your costates in main would be converted to a function
like above. Each nested cofunction would have to have a similar
structure.

Then in your main() loop, call the function periodically.

If you have many costates and cofunctions, then moving to a
real exec like TurboTask or uCos may be best.

You can get away with no exec at all. ST provides a periodic
timer via startTimer(). This will call a user function periodically.
This is in effect a background task. One advantage of this is
that the background task is more real-time. Add to that a state-machine
approach and you can do some efficient task switching.

My Timer B will also call a user function periodically (from
once every 15us down to once every 1500 seconds.) That gives you
another real-time thread. The lib can be found on my free libs
page under: Rabbit Libraries Home
Page

Another option is SHDesigns CoExec. This is a free, simple
multi-tasking exec for Softools. It is a real task-switcher with
less overhead than Costates. Once you use it, you can do much
better task switching than DC has. It also emulates some of the
DC costate syntax. Ther is also no need for the "cofunc"
identifier; all functions are the same and can handle task switches
with no special functions types.