Pumpkin, Inc.

Pumpkin User Forums

More than 3 tasks?

If you're having difficulty with Salvo's configuration options, post it here.

More than 3 tasks?

Postby Salvo Tech Support » Tue Aug 28, 2001 12:57 am

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.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: More than 3 tasks?

Postby srhoar » Tue Aug 28, 2001 11:39 am

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).]

srhoar
 
Posts: 5
Joined: Mon Aug 13, 2001 11:00 pm
Location: arlington,tx,usa


Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests