The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2024, 01:18:42 13:18


Login with username, password and session length


Pages: [1]
Print
Author Topic: OSA RTOS and MikroC Pro 4.60  (Read 15517 times)
0 Members and 1 Guest are viewing this topic.
PCROBOTICS
V.I.P
Junior Member
*****
Offline Offline

Posts: 63

Thank You
-Given: 958
-Receive: 178


Smile souling my love, weŽll always be together...


« on: May 19, 2011, 07:32:26 07:32 »

Smiley Hi I'm starting to work with OSA RTOS and am trying to make it work using the compiler MikroC PRO 4.60 and pic12f675 microcontroller, I have not made ​​it to work and need help from someone who has made ​​or more experience in this of the RTOS to please help.
Logged

"We are made of stardust."
Carl Sagan
sughoi
Junior Member
**
Offline Offline

Posts: 63

Thank You
-Given: 221
-Receive: 53


know thyself because what else is there to know


« Reply #1 on: May 19, 2011, 08:08:47 08:08 »

Dear PCROBOTICS

I'm also a newbie in RTOS applications. It is not easy to find right documents and right libraries, even finding a "hello world" project. All the example program neither can be complied nor can be changed by the user in a simple way. But anyway I hope we will do it one day!

The main problems are adding a lot of header & source code and making a couple of configuration. Till now the simplest RTOS I have ever seen is CCS compiler's RTOS. Easy to use and no need to make a huge amount of configuration.

best regards, sughoi  
Logged
pelctronics
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 9
-Receive: 11


« Reply #2 on: May 19, 2011, 09:41:48 09:41 »

Code:
include osa.h;



void Task1 (void)
{

 for (;;)
 {
    TRISB=0;
     PORTB=255;            //create task
     Delay_ms(150);
     PORTB=0;
     Delay_ms(150);
     OS_Yield();
     }



}



void Task2 (void)
{

 for (;;)
 {
    TRISB=0;
     PORTB=255;            //create task
     Delay_ms(150);
     PORTB=0;
     Delay_ms(150);
     OS_Yield();
     }



}

#pragma funcall main Task1  //this is important to MikroC
#pragma funcall main Task2


void main()

{


 OS_Init();



 OS_Task_Create(7, Task1); // 7 is priority , name of task is pointer to function where is your task in memory.
 OS_Task_Create(7, Task2);
 
 OS_Run();




}

cheers
Logged
sughoi
Junior Member
**
Offline Offline

Posts: 63

Thank You
-Given: 221
-Receive: 53


know thyself because what else is there to know


« Reply #3 on: May 21, 2011, 11:27:12 11:27 »

Dear friends I have a question I want to manage three different tasks via OSA and mikroc source code, even though I configured the system for 3 different tasks the system only manages 2 different tasks. If some helps me, I will be appreciate. My two source codes (main and OSAcfg) is below;
Code:
#include "osa.h"

#define T2CON_CONST     0x25        // post = 8, period = 250*4*5* 0.2 us = 1 ms

#define PR2_CONST       (250-1)

void Init (void)

{

    TRISB = 0x00;

    PORTB = 0x00;

    T2CON = T2CON_CONST;

    PR2 = 250-1;

    INTCON = 0;

    PEIE_bit = 1;

    TMR2IE_bit = 1;

}

void interrupt (void)

{

    if (TMR2IF_bit)

    {

        OS_Timer();

        TMR2IF_bit = 0;

    }


}


void Task_1 (void)

{

    for(;;)

    {

        OS_Delay(65);

        PORTB.F0 = ~ PORTB.F0;

    }

}

void Task_2 (void)

{

    for(;;)

    {

        OS_Delay(230);

        PORTB.F1 = ~ PORTB.F1;

    }

}


void Task_3 (void)

{

    for(;;)

    {

        OS_Delay(250);

        PORTB.F2 = ~ PORTB.F2;

    }

}



#pragma funcall main Task_1

#pragma funcall main Task_2

#pragma funcall main Task_3


void main (void)

{

    Init();                             // Init periphery

    OS_Init();                          // Init OS


    OS_Task_Create(0, Task_1);    // Create tasks.

    OS_Task_Create(0, Task_2);   //

    OS_Task_Create(0, Task_3);     //


    OS_EI();                            // Enable interrupts

    OS_Run();                           // Running scheduler


}


-------------------------------------OSAcfg is below;

/******************************************************************************/

//

// This file was generated by OSAcfg_Tool utility.

// Do not modify it to prevent data loss on next editing.

//

// PROJECT NAME: Running lights

//

// PLATFORM:     mikroC for PIC16

//

/******************************************************************************/


#ifndef _OSACFG_H

#define _OSACFG_H



//------------------------------------------------------------------------------

// SYSTEM

//------------------------------------------------------------------------------


#define OS_TASKS                3   // Number of tasks that can be active at one time

#define OS_DISABLE_PRIORITY         //


//------------------------------------------------------------------------------

// ENABLE CONSTANTS

//------------------------------------------------------------------------------

#define OS_ENABLE_TTIMERS           // Enable task timers (OS_Delay and OS_xxx_Wait_TO)

#endif
Edit: Use Code posting samples of code.. Make it easy for others to read and no Wink;

« Last Edit: May 21, 2011, 11:42:53 11:42 by pickit2 » Logged
odsk
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 13
-Receive: 12


« Reply #4 on: July 28, 2011, 04:16:59 04:16 »

Hi
I did test your code and works good for me,
3 processes running.
Logged
vantusaonho
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 22
-Receive: 21


« Reply #5 on: September 15, 2012, 05:20:50 05:20 »

Hi, I also use MIkroC for Pic in several year. I would like to program RTOS for Pic by mikroC. You can see this link for instruction:
http://wiki.pic24.ru/doku.php/en/osa/ref/description/project
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC