Pumpkin, Inc.

Pumpkin User Forums

Does't work several OS_Delay's within one project

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

Does't work several OS_Delay's within one project

Postby Jonas » Sun Aug 22, 2004 9:35 am

Hello,
I make a project with the PIC16F877. I need several OS_Delays (2 bytes long) in several tasks. But found, that salvo handles only one of them (first), others doesn't work. Can you tell me where is the problem. Bad config or what?
I use salvo v2.2, project compile from source.

Thank you,
Jonas

[This message has been edited by Jonas (edited August 22, 2004).]

Jonas
 
Posts: 6
Joined: Mon Nov 24, 2003 12:00 am

Re: Does't work several OS_Delay's within one project

Postby aek » Sun Aug 22, 2004 9:47 am

Hi Jonas.

Assuming you've set OSBYTES_OF_DELAYS to 2 in your salvocfg.h, the usual reason for delays not working is that your application is not calling OSTimer() properly.

Ther's no limit to the number of times you can call OS_Delay() in a task, or how many tasks call OS_Delay().

Regards,

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

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

Re: Does't work several OS_Delay's within one project

Postby Jonas » Sun Aug 22, 2004 10:44 am

It's an example structure of my application.
OSBYTES_OF_DELAYS is set to "2".
Everything works fine when I get rid of os_delay in CTask.
code:
void CTask(void)
{
for(;;)
{
OS_WaitBinSem(Sem, CTask1);
for(a = 0; a < digit; a ++)
{
for(b = 0; b < digit; b ++)
{
"...do something..."

}
OS_Delay(3, CTask2);
}
}
}
}
******************************************************************/
void FTask()
{
for (;;)
{
OS_Stop(FTask1);
OS_Delay(500, FTask2);
"...do something..."
}
OS_Delay(500, FTask3);
"do something"
}
}
******************************************************************/
void interrupt IntVector( void )
{
if(T0IF)
{
OSTimer();
T0IF = 0;

}
}



both tasks has equal priority, interrupt routine is called every 200uS, MCU is running @20MHz.

Thanks,
Jonas


[This message has been edited by Jonas (edited August 22, 2004).]

[This message has been edited by aek (edited August 22, 2004).]

Jonas
 
Posts: 6
Joined: Mon Nov 24, 2003 12:00 am

Re: Does't work several OS_Delay's within one project

Postby aek » Sun Aug 22, 2004 11:15 am

Hi Jonas.

1) Where are a and b defined?

2) There are extra "}"'s in your code, so the structure doesn't make sense.

3) I suggest you use the timer interrupt code in salvo ut u1isr.c -- yours has some problems.

4) 200us OSTimer() calls are a little on the fast side (only 1,000 cycles) for a 20MHz PIC -- but I doubt that's an issue here.

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

[This message has been edited by aek (edited August 22, 2004).]

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

Re: Does't work several OS_Delay's within one project

Postby Jonas » Sun Aug 22, 2004 11:44 am

Thank you, I have completely rewrite source code bone following by your recommendations, and this solves the problem.
Best regards,
Jonas
Jonas
 
Posts: 6
Joined: Mon Nov 24, 2003 12:00 am


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron