Skip navigation

Sample application

The following example shows the ease of use of embOS.

Easy usage

The two tasks are activated and execute until they run into the delay, then suspend for the specified time and eventually continue execution.
You can write programs just as you always did, the only difference being that multiple programs run quasi-simultaneously.

#include "RTOS.h"

static OS_STACKPTR int StackHP[128], StackLP[128];  // Task stacks
static OS_TASK         TCBHP, TCBLP;                // Task-control-blocks

static void HPTask(void) {
  while (1) {

static void LPTask(void) {
  while (1) {

int main(void) {
  OS_InitKern();  // Initialize OS
  OS_InitHW();    // Initialize Hardware for OS
  OS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);
  OS_CREATETASK(&TCBLP, "LP Task", LPTask, 50, StackLP);
  OS_Start();     // Start multitasking
  return 0;