Pumpkin, Inc.

Pumpkin User Forums

strange

If you can't make Salvo do what you want it to do, post it here.

strange

Postby bessel » Thu May 29, 2003 12:45 am

I have the next program
************************************************************/

code:
#include "main.h"
#include <salvo.h>

_OSLabel(TaskA1)
_OSLabel(TaskB1)

void TaskA( void )
{
for (;;){
PORTA=PORTA^0x01;
OS_Yield(TaskA1);
}
}

void TaskB( void )
{
for (;;){
PORTB=PORTB^0x01;
OS_Yield(TaskB1);
}
}

void main( void )
{
ADCON1=0b00000111;

TRISA = 0x00;
TRISB = 0x00;
PORTB = 0x00;
PORTA = 0x00;
Init();

OSInit();

OSCreateTask(TaskA, OSTCBP(1), 5);
OSCreateTask(TaskB, OSTCBP(2), 10);

for (;;)
OSSched();
}

#if defined(MAKE_WITH_TINY_LIB) || defined(MAKE_WITH_SE_LIB)
void OSIdlingHook ( void )
{
;
}
#endif



I dont understand The period of signal RA0 and RB0 are identical
the priority is different
Thank for the answer

[This message has been edited by Salvo Tech Support (edited May 29, 2003).]

bessel
 
Posts: 2
Joined: Wed May 28, 2003 11:00 pm

Re: strange

Postby Salvo Tech Support » Thu May 29, 2003 12:55 am

Hello.

Since TaskA() has the higher priority, it is the only task that will run. TaskB() will never run, because TaskA() is always eligible and has a higher priority.

To run both tasks (and have the same period on RA0 and RB0), give both tasks the same priority. Or, delay one or both of the tasks, or use events.

Remember, the Salvo scheduler will always run the highest-priority eligible task.

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

[This message has been edited by Salvo Tech Support (edited May 29, 2003).]

--------
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: strange

Postby bessel » Thu May 29, 2003 1:31 am

thank to the rapid answer
where is the algorithm for the task
commutation (round robin or others) in the scheduler
I think that the task commutation was automatic in the kernel as OS9 Vxworks...
How to realise a task commutation with of priority differents betwnen the task ?
thanks
bessel
 
Posts: 2
Joined: Wed May 28, 2003 11:00 pm

Re: strange

Postby Salvo Tech Support » Thu May 29, 2003 1:42 am

Hello.

Salvo is an event-driven, priority-based multitasking cooperative RTOS that supports round-robin scheduling of tasks with the same priority.

It is quite different from OS9 or VxWorks, for obvious reasons.

The Salvo User Manual has an in-depth tutorial -- that would be a good place for you to start.

Regards,

------------------
--------
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: strange

Postby aek » Thu May 29, 2003 1:44 am

quote:
How to realise a task commutation with of priority differents betwnen the task ?
This goes to the heart of event-driven design -- the tutorial projects (tu6, specifically) and some of the App Notes on our site illustrate how to create Salvo applications that take advantage of multiple task priorities while multitasking.
quote:
where is the algorithm for the task
commutation (round robin or others) in the scheduler
I believe it's explained in the User Manual (esp. in the FAQ). The Salvo scheduler always runs the highest-priority, eligible task. Salvo tasks at the same priority will round-robin. (The scheduling algorithm is written to ensure round-robining at the same priority level.)

And of course, Salvo is not a time-sliced RTOS, so that sort of scheduling does not apply.

If you create three tasks in order A, B, C, all with the same priority, then in your example they will run as A .. B .. C .. A .. B .. C .. A ... forever. Of course if you delay a task or wait on an event inside a task, then the order will change based on delays and events happening ...

Regards,

------------------

[This message has been edited by aek (edited May 29, 2003).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: strange

Postby aek » Thu May 29, 2003 1:56 am

quote:
Salvo tasks at the same priority will round-robin.
To be clearer, I should have written "Eligible Salvo tasks at the same priority will round-robin."

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron