Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Self made Multitasking system

Not open for further replies.


Member level 2
Feb 21, 2002
Reaction score
Trophy points
Activity points
Have anyone a good self made multitasking or RTOS in C system.
I want to adapt the best multitasking system to my self made code generator (similar a VisualState from IAR). Thanks in advace

Regards cb30

You can search the word "Multitasking" in the link page of

**broken link removed**

Selfmade multitasking system

Hi all,

here attached you will find a very simple task scheduler completely written in C.

It supports "wait" and "signal" and timed events.

It is a cooperative RTOS (not preemptive) but it is very simple and has a very small footprint.

In few words each task is implemented as a sequence of activities and switching from one task to another is performed at the end of an activity.

The code is based on Hitachi H8 microprocessor but it is easily ported to any other microprocessor.

PM for more informations



Hi All,

I received several private messages requesting more informations on the scheduler code.

Unfortunately I did not had time to write documentation about this kernel.

However the strucure of the kernel is very simple and the I think the code is clear.

I will try to explain the main data structure.

Task_table is an array of task_descriptor.

Task descriptor contains:

Task_activity : pointer to the entry point of the activity

Task_timer is a counter used for timed events

Task_state contains task state and pending signals (see defines in kernel.c or kernel.h)

functions defined in kernel.c access the Task_table to create or delete tasks

A task can be suspended (via the wait function) to wait for a signal from another task or for a timeout event.

The scanner function scans the task table and give execution to the code pointed by Task_activity function pointer. When control returns to scanner it read the next entry in task table and so on

The scanner routine is countinously called by the main.

Tasks.c contain a very simple example

I think the better way is to read careffully the code (it is really simple).

However I will try to make some comments in the code for better understanding and I will post it again in the next days.


Hi all.
The idea is convert a Grafcet diagram to C multitasking leguaje for any
Ansi C compiler, included C*C*S and Code/Vision.
Look this Grafcet diagram.

Not open for further replies.

Part and Inventory Search

Welcome to