Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 08:07:34 08:07


Login with username, password and session length


Pages: [1]
Print
Author Topic: mixing RTOS with conventional programming  (Read 10649 times)
0 Members and 2 Guests are viewing this topic.
odsk
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 13
-Receive: 12


« on: June 06, 2011, 06:51:08 18:51 »

Hi,
I am trying to use RTOS for my future desing and do have a newbie question to the experts:
Can I mix convetional programing (using interrupts...etc) with RTOS processes?
I am trying to receive data through UART and was hoping to use interrupt driven events to receive the data compared to running a process at determined intervals (RTOS) for fetching the data.

Regards,
ODSK
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4667

Thank You
-Given: 834
-Receive: 4321


There is no evidence that I muted SoNsIvRi


« Reply #1 on: June 10, 2011, 07:28:28 19:28 »

simple answer is yes.
http://www.scribd.com/doc/46919105/RTOS

RTOS Scheduling Algorithms Polled Loop System w/interrupts
 
• Polling system goodfit; however, several time sensitive critical tasks exists
• Example: transistor amplifier overheat
– employ interrupts


RTOS Scheduling Algorithms Interrupt Driven System
• Main program consists of systeminitialization activities
• System then placed in continuous loop towait for interrupt driven events
• System prioritizes multiple interrupts andhandles highest priority tasks first
• Example: Wall-following Robot
 


 

« Last Edit: June 10, 2011, 08:04:48 20:04 by pickit2 » Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
sam_des
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 128
-Receive: 151


« Reply #2 on: June 11, 2011, 03:45:00 03:45 »

Hi,

Quote
Can I mix convetional programing (using interrupts...etc) with RTOS processes?
Yes, you can. In fact that's how the systems with OS works. Most of the time your tasks are blocked, waiting for something to happen. Like timer expire, button press or serial rx/tx etc.. And when it happens OS wakes/unblocks the corresponding task which takes the necessary action and returns to blocked state.
That's how you can determine the loading of your processor. Just measure how much time it spends in idle task within OS  Wink

Only requirement in case of interrupts is that you must inform OS about it. OS requires this information for handling interrupt nesting and context switching(in case an interrupt makes higher priority task ready). Since in RTOSs, Application handles the interrupts instead of OS, it's the duty of application to inform OS about it

Quote
I am trying to receive data through UART and was hoping to use interrupt driven events to receive the data compared to running a process at determined intervals (RTOS) for fetching the data.
There is no need to wake the task on each received byte or some predetermined interval. All you have to do is to agree upon the FRAME which will be used to both transmit and receive. After that your interrupt will continue receiving data until complete frame has been received and wake the task only then. That way none of processor time is wasted and task executes only when required.
Note that you require BYTE FIFO queues and many RTOSs does not provide them. Instead they provide message queues which are usually used for intertask comm. You can use them, but that will waste the RAM as message queue element is usually (void*) pointer. In that case you may require to write down your own BYTE queue function using other OS services.

hope that helps
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
pak
Junior Member
**
Offline Offline

Posts: 61

Thank You
-Given: 5
-Receive: 17


« Reply #3 on: December 08, 2011, 05:57:34 05:57 »

Quote
Can I mix convetional programing (using interrupts...etc) with RTOS processes?
I am trying to receive data through UART and was hoping to use interrupt driven events to receive the data compared to running a process at determined intervals (RTOS) for fetching the data.


Just need to take care of global variables by using two methods,
1) Stop/Restart interrupt and os scheduler
2) message from ISR to Task

Regards,
pak

  Smiley Happy Microcontroller Programming  Smiley
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC