"Howard Long" <howard@howardlongxxx.com> wrote in message
> Here's my example. In the DSP/BIOS config file I have two tasks calling
> _tsk0 and _tsk1, both at priority 0,
... should read at priority 1. Priority 0 should be left to the DSP/BIOS
idle task.
Cheers, Howard
Reply by Howard Long●June 15, 20062006-06-15
"jayadevan" <jaggunitj@yahoo.co.uk> wrote in message
news:78idnWKiWed2QxLZnZ2dnUVZ_sidnZ2d@giganews.com...
>
> hi to all
>
> I am doing a project in which i have to implement multitasking.
> what i have done was that i created two tsk objects and each have
> seperate functions to run.
>
> i have implemented it gradually.
>
> firstly i have defined one functionn and made it to run using one tsk
> object.this was ok
>
> then i defined second function and made the second function to run by the
> second object.this time error was there.
>
> i am not able to resolve it.
>
> like this i have to implement some more tasks in the same program.but i am
> not able to move forward
I am going to guess what is going on here.
Firstly I will assume that both are in an endless loop. Assuming they are
the same priority, you must run a TSK_yield(). They will not pre-empt.
Here's my example. In the DSP/BIOS config file I have two tasks calling
_tsk0 and _tsk1, both at priority 0, and a log object LOG0. Try commenting
out the TSK_yield from one of the tsk# functions. Also try changing the
priorities to see what happens. As well as the Message log, take a look at
the CPU Execution graph.
#include <log.h>
#include <tsk.h>
extern LOG_Obj LOG0;
void main()
{
}
void tsk0(int nId)
{
while(1)
{
int i;
for (i=0;i<5;i++)
{
LOG_printf(&LOG0,"tsk0, id=%d, iter=%d\n",nId,i);
}
TSK_yield();
}
}
void tsk1(int nId)
{
while(1)
{
int i;
for (i=0;i<5;i++)
{
LOG_printf(&LOG0,"tsk1, id=%d, iter=%d\n",nId,i);
}
TSK_yield();
}
}
You will see this in the LOG0 message log:
2695067 tsk1, iter=2
2695068 tsk1, iter=3
2695069 tsk1, iter=4
2695070 tsk0, iter=0
2695071 tsk0, iter=1
2695072 tsk0, iter=2
2695073 tsk0, iter=3
2695074 tsk0, iter=4
2695075 tsk1, iter=0
2695076 tsk1, iter=1
2695077 tsk1, iter=2
2695078 tsk1, iter=3
2695079 tsk1, iter=4
2695080 tsk0, iter=0
2695081 tsk0, iter=1
2695082 tsk0, iter=2
2695083 tsk0, iter=3
2695084 tsk0, iter=4
spru303b http://focus.ti.com/lit/ug/spru303b/spru303b.pdf section 4.4.6 also
has a good example.
Reply by mlimber●June 14, 20062006-06-14
jayadevan wrote:
> hi to all
>
> I am doing a project in which i have to implement multitasking.
> what i have done was that i created two tsk objects and each have
> seperate functions to run.
>
> i have implemented it gradually.
>
> firstly i have defined one functionn and made it to run using one tsk
> object.this was ok
>
> then i defined second function and made the second function to run by the
> second object.this time error was there.
>
> i am not able to resolve it.
>
> like this i have to implement some more tasks in the same program.but i am
> not able to move forward
We feel your pain, but we really can't help you unless you tell us the
nature of the error.
Cheers! --M
Reply by jayadevan●June 14, 20062006-06-14
hi to all
I am doing a project in which i have to implement multitasking.
what i have done was that i created two tsk objects and each have
seperate functions to run.
i have implemented it gradually.
firstly i have defined one functionn and made it to run using one tsk
object.this was ok
then i defined second function and made the second function to run by the
second object.this time error was there.
i am not able to resolve it.
like this i have to implement some more tasks in the same program.but i am
not able to move forward