?What can I use instead of uCOS-II in my Rabbit products?

There is an alternative in Dynamic C 10.72.  Basically, look at coprocess.lib.  There are 3 functions: cop_create(), cop_yield(), cop_resume().  The initial process (main) 
will create necessary coprocesses, then run them in sequence using cop_resume().  The coprocess (tasks) only call cop_yield() when they are waiting for some event, and are 
able to yield control back to the main scheduler.

Each coprocess requires a 4k aligned stack (use _xalloc to get aligned memory) since the stack switching depends on this.

Static and global variables are shared, as in uCOS.  Local vars (on stack) are unique to each coprocess, as you would expect.

Where you call OSTimeDly(n), call cop_yield() instead.  Pass a parameter in the yield call back to the main scheduler, which it will use as the desired wait time, or 
pass NULL if no time delay is required, but the coprocess is just being - well - cooperative with other tasks.  (This is just a suggestion - the pointer passed in the yield 
call is seen as the return value of the last resume call done by the scheduler, so can be used for any special requirements like setting timers and so on).
Last updated: Aug 23, 2017

Filed Under


Recently Viewed Articles

No recently viewed articles