Chapter 1


The dsPIC Threads Library provides basic cooperative multitasking/multi-threading to the Microchip dsPIC family of microcontrollers. It is written mostly in C. It implements a simple round-robin style task switcher.

The cooperative multitasking design results in task switches that are less expensive than would be possible with preemptive multitasking. This also allows the library to be implemented in such a way that interrupts are never disabled.

This library provides basic thread start and stop functions, a way to associate thread-local storage to threads, and some basic thread management functions, including a way to determine a thread’s stack usage.

I have released this code under the GNU General Public License with the hope that others might find it useful.