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 CCS Technical Support

How can I time out during an rtos task?

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



Joined: 12 Feb 2007
Posts: 2

View user's profile Send private message

How can I time out during an rtos task?
PostPosted: Mon Feb 12, 2007 8:00 am     Reply with quote

I have an rtos task that I need to exit if it takes too long. I tried using the rtos_overrun function to see if it takes too long, but it does not seem to work unless I first yield to the rtos, in which case my task will not re-enter until it is next scheduled. I can use a timer but then I have to keep track of my oscillator frequency and the number of timer rollovers, which is okay but not that clean. Any ideas? Thanks.
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Mon Feb 12, 2007 8:08 am     Reply with quote

The timer method popped into my head when I saw the title of your post and it seems a good solution. Can you give an estimate about the normal execution time of the task and the time after which you can consider it timed out?
dansimon



Joined: 12 Feb 2007
Posts: 2

View user's profile Send private message

PostPosted: Mon Feb 12, 2007 8:21 am     Reply with quote

One task needs to time out after about 100 ms, another after about 30 sec. So if I set up Timer1, say, to roll over every 100 ms, then one rollover would timeout my first task, and 300 rollovers would timeout my second task. I think that would work fine, but with all of the built-in rtos functions that CCS has I thought there would be some more automatic way to do it. This is the first time I am using the rtos.
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Mon Feb 12, 2007 3:06 pm     Reply with quote

Yes, timers would do the job. Easy to implement.

CCS' RTOS is a rather simple cooperative multitasking scheduler, mostly because of the limitations of the PIC's architecture, but it does it's job very well. You can't ask too much from it though.

rtos_overrun() is for checking if a task has exceeded its allocated execution time. I don't see how you can use that here.
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