CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Rtos task rate and minor_cycle relationship

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Onur



Joined: 11 Apr 2004
Posts: 11

View user's profile Send private message

Rtos task rate and minor_cycle relationship
PostPosted: Mon Aug 10, 2009 3:53 am     Reply with quote

Hello I want to ask about Rtos

this is main Rtos parameters

Code:
#use rtos(timer=0,minor_cycle=1ms)


My tasks are

Code:
#task(rate=1s,max=1ms)
void The_first_rtos_task ( );

#task(rate=1s,max=1ms)
void The_second_rtos_task ( );

#task(rate=500ms,max=1ms)
void The_third_rtos_task ( );

#task(rate=500ms,max=1ms)
void The_fourth_rtos_task ( );

#task(rate=250ms,max=1ms)
void The_fifth_rtos_task ( );

#task(rate=250ms,max=1ms)
void The_sixth_rtos_task ( );

#task(rate=125ms,max=1ms)
void The_seventh_rtos_task ( );

#task(rate=125ms,max=1ms)
void The_eighth_rtos_task ( );

#task(rate=65ms,max=1ms)
void The_nineth_rtos_task ( );

#task(rate=65ms,max=1ms)
void The_tenth_rtos_task ( );

#task(rate=4ms,max=1ms)
void The_eleventh_rtos_task ( );


inside of task

Code:

void The_first_rtos_task ( )
{   
   if (flag==0){
      flag=1;
      rtos_disable(The_second_rtos_task);       
   }else{
      rtos_enable(The_second_rtos_task);     
      flag=0;
}

void The_second_rtos_task ( )
{
   output_toggle(LED1);
}

other tasks are similar just timings are different.

the problem is

Code:

#task(rate=1s,max=1ms)
#task(rate=500ms,max=1ms)


this two tasks doesnt start from begining. what im doing is just flashing leds.

after I reset pic those two task doesnt start. maybe it tooks about 7sec to start.

if I use minor_cycle grater than 4or 5ms every thing is ok. the thing is I will add lots of task and I want to use faster minor.

Im not use but maybe minor_cycle uses 1byte varible or
rate uses 1byte varible

so when minor_cycle = 1ms if task rate=500 then multiply result grater than 1 byte.

What do you think?

Thank you for reading.


Last edited by Onur on Mon Aug 10, 2009 7:55 am; edited 1 time in total
Onur



Joined: 11 Apr 2004
Posts: 11

View user's profile Send private message

Im just guessing
PostPosted: Mon Aug 10, 2009 7:54 am     Reply with quote

I guess

Task rate /minor_cycle =should be less then 255 (1 byte )

For example
Code:
#use rtos(timer=0,minor_cycle=2ms)


Code:

#task(rate=500ms,max=2ms)
void The_first_rtos_task ( );
This will be work correctly.

Code:

#task(rate=1000ms,max=2ms)
void The_first_rtos_task ( );
This will not work correctly.

Is there any way to fix?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group