Pumpkin User Forums
  Configuration
  More than 3 tasks?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   More than 3 tasks?
Salvo Tech Support
Moderator
posted August 28, 2001 13:57     Click Here to See the Profile for Salvo Tech Support     Edit/Delete Message   Reply w/Quote
Hi Robert.

In v2.2.0 you can "overwrite" the built-in idle task with one of your tasks, as you suspected. But you need to do a little extra in order for OSCreateTask() to succeed. With your code, if you check the return value of

code:
OSCreateTask(DamperOpen,OSTCBP(4),1);

you'll find that it's returning an error, OSERR_BAD_P. That's because in v2.2.0 you can only create a task in an empty, initialized control block. With the freeware library you're using, the idle task is already in there ...

So, you can do it in one of two ways:

code:
OSDestroyTask(OSTCBP(4)));
OSCreateTask(DamperOpen,OSTCBP(4),1);

or

code:
OSInitTcb(OSTCBP(4));
OSCreateTask(DamperOpen,OSTCBP(4),1);

The first method is much safer. The second method will work only if it's done before any calls to OSSched().

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

IP: 63.203.232.106

srhoar
Junior Member
posted August 28, 2001 12:39     Click Here to See the Profile for srhoar     Edit/Delete Message   Reply w/Quote
It seems that I can't get more then 3 tasks to run.

Even if I change the salvocfg.h to

code:

#if !defined (MAKE_WITH_FREE_LIB) && !defined (MAKE_WITH_STD_LIB)

/* */
/* configuration options for project that's made using the */
/* source files. */
/* */

#define OSBYTES_OF_DELAYS 1
#define OSENABLE_SEMAPHORES TRUE
#define OSEVENTS 2
#define OSTASKS 4
#define OSLOC_ALL bank1

#else

/* */
/* configuration options for projects that are made using */
/* either the freeware or standard libraries. Multitasking */
/* with delays and events, events services called only */
/* from background. */
/* */

#define OSUSE_LIBRARY TRUE
#ifdef MAKE_WITH_FREE_LIB
#define OSLIBRARY_TYPE OSF
#elif defined(MAKE_WITH_STD_LIB)
#define OSLIBRARY_TYPE OSL
#endif
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSEVENTS 2
#define OSTASKS 4


#endif


The 4th task created will not run at all even with the highest proirity.

code:

void main(void)
{

OSInit(); //Initialize OS

OSEnableInts();

OSCreateTask(TempCheck,OSTCBP(1),6); //Create Tasks,unique#1,Priority 10
OSCreateTask(Clockit,OSTCBP(2),8); //Create Tasks,unique#1,Priority 10
OSCreateTask(DamperClosed,OSTCBP(3),4); //Create Tasks,unique#1,Priority 10
OSCreateTask(DamperOpen,OSTCBP(4),1); //Create Tasks,unique#1,Priority 10

OSCreateSem(DAMPER_OPEN,0);
OSCreateSem(DAMPER_CLOSED,0);


PORTB=0;
PORTA=0;
TRISB=0;
TRISA=1;
while(1) //do this forever
{
OSSched(); //new way, just call OS Scheduler
OSTimer();
}
}



[This message has been edited by srhoar (edited August 28, 2001).]

[This message has been edited by srhoar (edited August 28, 2001).]

[This message has been edited by srhoar (edited August 28, 2001).]

[This message has been edited by srhoar (edited August 28, 2001).]

IP: 204.155.148.6

All times are ET

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Pumpkin Home Page

2000-2008 Pumpkin, Inc. All Rights Reserved. Pumpkin and the Pumpkin logo, Salvo and the Salvo logo, The RTOS that runs in tiny places, CubeSat Kit and the CubeSat Kit logo are all trademarks of Pumpkin, Inc. All other trademarks are the properties of their respective owners.


Ultimate Bulletin Board 5.46a