MicroElektronics Designs

Home
About Us
Services
Clients
Free stuff
Related Links
Contact Us

Free Stuff

Tiny Threads - Tiny Multitasking Threads for Microcontrollers

by: Regulus Berdin
Limitations:
  • Maximum 254 lines per thread.
  • Thread context switching will not work within a switch block.
Usage example:
     TT_DEF(1)
     {
        TT_BEGIN(1);
     	while (1)
        {
           ...
           TT_SWITCH(1);
           ...
           ...
           TT_WAIT_UNTIL(1,keypress);
        }
        TT_END(1);
     }
     
     TT_DEF(LED_TASK)
     {
         TT_BEGIN(LED_TASK);
         while (1)
         {
             LedOn();
             delay=DELAY_1_SECOND;
             TT_WAIT_UNTIL(LED_TASK,delay==0);
             LedOff();
             delay=DELAY_1_SECOND;
             TT_WAIT_UNTIL(LED_TASK,delay==0);
         }
         TT_END(LED_TASK);
     }
      
     void main(void) 
     {
         ...
         ...
         while(1)
         {
             TT_SCHED(1);
             TT_SCHED(LED_TASK);
         }
     }
Download:
  • tthread.h - header file for Tiny Threads. This is the only file needed to use Tiny Threads.
  • tt_sample.zip - sample application using tthread. Compiles with PICC compiler.

Interrupt Driven Serial Routines with Circular FIFO

Download serial.zip

PIC microcontroller code snippets


Please visit also my blog The Cebuano Geek. Here I will post my new codes and ideas.

transparent