Table of Contents

OSA : Project

Creating a project

To use OSA in your application you need to do the following:

  1. Create a project using IDE. In addition to all your project files add the file osa.c to your project (it contains all system variables and function prototypes);
  2. In your project folder create the file OSAcfg.h. This file is used to specify OSA compilation parameters (like number of tasks, timer type etc). In the simplest case this file can be empty. You can use the program OSAcfg_Tool to create/modify this file;
  3. Insert the line "include <osa.h>" into all files that will use OSA services;
  4. Add two "Include search paths" to project options:
    • the path to OSAcfg.h for your current project
    • the path to osa.h;
  5. At the beginning of function main() insert a call to the OS_Init() service;
  6. At the end of function main() insert a call to the OS_Run() service;

Notes for different IDEs and platforms

MPLAB

MPLAB and HT-PICC

void main (void)
{
    OS_Init();
    ...
    OS_Task_Define(Task_Buttons);
    OS_Task_Define(Task_LEDs);
    OS_Task_Define(Task_LCD);
    ...
    OS_Task_Create(Task_Buttons);
    OS_Task_Create(Task_LEDs);
    OS_Task_Create(Task_LCD);
 
}

MPLAB and Mplab C18

MPLAB and Mplab C30

CCS

void main (void)
{
    OS_Init();
    ...
    OS_Task_Define(Task_Buttons);
    OS_Task_Define(Task_LEDs);
    OS_Task_Define(Task_LCD);
    ...
    OS_Task_Create(Task_Buttons);
    OS_Task_Create(Task_LEDs);
    OS_Task_Create(Task_LCD);
 
}

mikroC PRO IDE

#pragma funcall main Task_Buttons       // Tell linker that function will be
                                        // called indirectly
 
void Task_Buttons (void)
{
    ...
}

AVR Studio and WinAVR

IAR

IAR and STM8

STVD and STM8

Raisonance and STM8