CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

OSA - RTOS for PIC controllers
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
skoberlink



Joined: 27 May 2010
Posts: 52

View user's profile Send private message

PostPosted: Wed Jul 21, 2010 9:20 am     Reply with quote

So thanks again for helping me get it working. I've been playing with it and came across an issue. It's not a problem just something I'm curious about.

I have a task that I would like defined in another object file. This causes an error. Do task have to be defined in the main file? If not, how can I define them somewhere else?

Like I said not a big issue, just keeps my code neater in my opnion.
tester



Joined: 29 Jun 2009
Posts: 40
Location: Russia, SPb

View user's profile Send private message Visit poster's website

PostPosted: Wed Aug 04, 2010 7:41 am     Reply with quote

skoberlink wrote:
I have a task that I would like defined in another object file. This causes an error. Do task have to be defined in the main file? If not, how can I define them somewhere else?

Yes, the task should be defined in main():
Code:

void MyTask (void); // prototype

void main (void)
{
    ...
    OS_Task_Define( MyTask);
    OS_Task_Create(0, MyTask);
    ...
    OS_Run();
}


P.S. Don't forget, that CCS does not link object files correctly.
skoberlink



Joined: 27 May 2010
Posts: 52

View user's profile Send private message

PostPosted: Mon Aug 09, 2010 9:59 am     Reply with quote

I'm having another problem that I don't quite understand. At this point i've run several simple test programs without any problems using OSA. I'm using OSA in a program now and the tasks are never entered. I tracked it down to that the OS_State.bEnable variable was never enabled. This seemed to get reset during the call to _OS_SET_STATE(); I'm not sure why this would be. Any suggestions?

Code:
#define OS_Sched()                                                               \
    {                                                                            \
        _OS_temp = 0;                                                            \
                                                                                 \
        IF_NOT_IS_IN_CRITICAL_SECTION()                                          \
        {                                                                        \
            if (_OS_CurTask >= (OST_TASK_POINTER)OS_TaskVars + (OS_TASKS-1))     \
                _OS_CurTask = (OST_TASK_POINTER)OS_TaskVars;                     \
            else                                                                 \
                _OS_CurTask++;                                                   \
        }                                                                        \
                                                                                 \
        _OS_SET_STATE();                                                         \ //This resets the bEnable bit
                                                                                 \
        /* Skip empty descriptor              */                                 \
        if (!_OS_bTaskEnable || _OS_bTaskPaused) goto _LABEL_SCHED_CONTINUE;     \ //bEnable has been reset here so it doesn't enter the task, it just skips to the next loop
                                                                                 \
        IF_NOT_OS_CHECK_DELAYS_GOTO_SCHED_CONTINUE;                              \                                                                             
                                                                                 \
        _OS_JumpToTask();                                                        \
        _OS_SaveRetAddr();                                                       \
                                                                                 \
    _LABEL_SCHED_CONTINUE:;                                                      \
    }
tester



Joined: 29 Jun 2009
Posts: 40
Location: Russia, SPb

View user's profile Send private message Visit poster's website

PostPosted: Tue Aug 10, 2010 9:30 am     Reply with quote

skoberlink wrote:
I'm having another problem that I don't quite understand.

Does the bEnable flag become set after OS_Task_Create?
Do you use OS_Task_Stop or OS_Task_Delete services?
Is OS_TASKS set properly?
skoberlink



Joined: 27 May 2010
Posts: 52

View user's profile Send private message

PostPosted: Tue Aug 10, 2010 9:36 am     Reply with quote

tester wrote:
skoberlink wrote:
I'm having another problem that I don't quite understand.

Does the bEnable flag become set after OS_Task_Create?
Do you use OS_Task_Stop or OS_Task_Delete services?
Is OS_TASKS set properly?


The bEnable flag is set in both OS_state and OS_CurTask after the call to OS_Task_Create(). It is reset in OS_state but not in OS_CurTask after the call to OS_SET_STATE.

I do not use OS_Task_Stop or OS_Task_Delete

OS_TASKS is set to 1 currently as I am converting code over one task at a time. There is only 1 task being created and run.
tester



Joined: 29 Jun 2009
Posts: 40
Location: Russia, SPb

View user's profile Send private message Visit poster's website

PostPosted: Tue Aug 10, 2010 9:51 am     Reply with quote

skoberlink wrote:
The bEnable flag is set in both OS_state and OS_CurTask after the call to OS_Task_Create(). It is reset in OS_state but not in OS_CurTask after the call to OS_SET_STATE.

I do not use OS_Task_Stop or OS_Task_Delete

OS_TASKS is set to 1 currently as I am converting code over one task at a time. There is only 1 task being created and run.

Can you send me your project? (e-mail: osa at pic24.ru)
chargedneuron



Joined: 05 May 2007
Posts: 6
Location: Springfield, Oregon, USA

View user's profile Send private message Visit poster's website AIM Address

PostPosted: Thu Apr 14, 2011 11:34 am     Reply with quote

I was attempting to give this RTOS a try but I get the following error when I compile their tutorial #1;

Improper use of a function identifier

Code:
*** Error 117 "tutor1.c" Line 178(31,32): Improper use of a function identifier
*** Error 117 "tutor1.c" Line 179(31,32): Improper use of a function identifier


I am using compiler 4.096.

The command on that line is;

Code:
OS_Task_Create(0, Task_T1); // Tell to OS that Task_T1 and Task_T2 will
    OS_Task_Create(1, Task_T2); // be called by scheduler


the origin of that command is in OSA_Pic18_CCS.h as;

Code:
/************************************************************************/
/*                                                                      */
/* Create task                                                          */
/*                                                                      */
/************************************************************************/

#define OS_Task_Create(priority, TaskName)                          \
    {                                                               \
        _OS_Task_Create(priority, (OST_CODE_POINTER)TaskName);      \
    }

#define OS_Task_Create_M(priority, TaskName)                        \
    {                                                               \
        OS_Task_Reserve(TaskName);                                  \
        _OS_Task_Create(priority, (OST_CODE_POINTER)TaskName);      \
     }


Any suggestions as to how to correct this? My thanks in advance.
_________________
"Trouble? I call it sport!" - Hyde - The League of Extraordinary Gentlemen

chargedneuron



Joined: 05 May 2007
Posts: 6
Location: Springfield, Oregon, USA

View user's profile Send private message Visit poster's website AIM Address

PostPosted: Thu Mar 22, 2012 1:25 am     Reply with quote

After working with one of the designers. it turns out that the PIC18 Specific header required a fix.
_________________
"Trouble? I call it sport!" - Hyde - The League of Extraordinary Gentlemen

Bill24



Joined: 30 Jun 2012
Posts: 45

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 7:13 am     Reply with quote

I am testing OSA version3 using a PIC18F46K80 and CCS compiler version 4.135

The example worked with very little fuss. I had to change to location of OSA.h to get it to run.

Looking through the code, to define a task eg
Code:

OS_Task_Reserve(Task_Rolling);       // Define tasks

Some code is called as follows:
Code:

/******************************************/
/*                                                                      */
/* Create task by indirect address                       */
/*                                                                      */
/******************************************/

#define OS_Task_Reserve(TaskName)                    \
        if (_pcl & 1) TaskName();

Could someone please tell me what this does and how it works.
I am intrigued.
future



Joined: 14 May 2004
Posts: 321

View user's profile Send private message

PostPosted: Sun Sep 23, 2012 8:03 am     Reply with quote

It tells the compiler to not remove the function otherwise it will not get into the final code.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group