Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interrupt or rtos in microcontroller

Status
Not open for further replies.

hemnath

Advanced Member level 3
Advanced Member level 3
Joined
Jun 24, 2012
Messages
702
Helped
61
Reputation
120
Reaction score
57
Trophy points
1,308
Location
Chennai
Activity points
6,589
I'm new to RTOS. I have experience in interrupts in microcontroller. I have used it in many of my projects.

Let's say, I have a sensor where I will process and display the value on lcd or graphic lcd. I have keypad for the menu navigation to change the parameters values. output relays to be activated or deactivated based on the sensor value. Blinking action on led. I have used interrupt for blinking of LED.

For the above process, interrupt is enough or RTOS is required. How RTOS varies from Interrupt. I'm interested to learn it. Can you guys please explain in detail for my application.
 

Hi,

I'd work with interrupts.
RTOS takes more processing power overhead.
(But your tasks don't seem to take much processing power, thus you are free to use RTOS)
****

Most of your tasks I'd process in main loop, while the timing for the tasks is interrupt controlled.

First consider the timing for the tasks: (example)
Scanning keys: every 50ms with hardware debouncing (every 10ms with software debouncing).
Display update: (with previous sensor readout and value calculation): every 300ms (up to 500 ms)
Relay switching: maybe every 100ms (or 20ms if you need it fast)
LED blink: every 500ms (or 200ms for fast blink)

Then let only the fastest being processed in interrupt context (5ms, 10ms, 20ms tasks),
for all the others just set the flags in the ISR, but process them in main loop.

Don't use busy waits at all, if possible, (better use counters in the ISR).

Klaus
 
I would say it is totally depends on requirements and cost of your project.
Above things can be manageable with interrupt. And for that you can us controlller with limited flash and with cheap controller.

If you want to try RTOS then first thing you will need is flash and better clock frequency, which is obvious links to cost.


As @KlausST suggested, the way how you can manage your tasks with interrupt.
 

I'm new to RTOS. I have experience in interrupts in microcontroller. I have used it in many of my projects.

Let's say, I have a sensor where I will process and display the value on lcd or graphic lcd. I have keypad for the menu navigation to change the parameters values. output relays to be activated or deactivated based on the sensor value. Blinking action on led. I have used interrupt for blinking of LED.

For the above process, interrupt is enough or RTOS is required. How RTOS varies from Interrupt. I'm interested to learn it. Can you guys please explain in detail for my application.

Rtos is useful when you have many complex realtime events occuring and the 'simultaneous' nature of processing is important.

In your case you have just a very few realtime events and actions. You can easily implement direct code to manage this.

Just make clever use of isr's and flags/ semaphores.
 

I find RTOS could give a more elegant solution by separating the tasks; keyboard, sensor, LCD and using mailboxes or message queues to pass data around. It depends on your resources on your microcontroller as each tasks will require memory. You could also designed using interrupts and depending on your timing requirements, you could use a state machine or create an event driven system similar to QP framework by Miro Samek. The one good thing about RTOS, you can set task priorities. You would have to implement it yourself if you take the interrupt route. At my previous work, we chose a RTOS for the LCD for handling the buttons and animation plus controlling the drum/motor of a washing machine.
 

I find RTOS could give a more elegant solution by separating the tasks; keyboard, sensor, LCD and using mailboxes or message queues to pass data around. It depends on your resources on your microcontroller as each tasks will require memory. You could also designed using interrupts and depending on your timing requirements, you could use a state machine or create an event driven system similar to QP framework by Miro Samek. The one good thing about RTOS, you can set task priorities. You would have to implement it yourself if you take the interrupt route. At my previous work, we chose a RTOS for the LCD for handling the buttons and animation plus controlling the drum/motor of a washing machine.

Rtos is obviously a huge overkill for the processing elements outlined by OP. OP is still at the stage of blinking lights using interrupts. Don't encourage this path. Let him learn more about REAL time processing before adding the confusion of rtos layer.

I don't think he's ready yet.
 

Rtos is obviously a huge overkill for the processing elements outlined by OP. OP is still at the stage of blinking lights using interrupts. Don't encourage this path. Let him learn more about REAL time processing before adding the confusion of rtos layer.

I don't think he's ready yet.

He mentioned that he has writing an application to blink LEDs with interrupts but wants to design an application using graphical LCD and keyboard. It is no harm for someone to try out different things as this is not made into a product else how would you learn. You learn by tinkering. If it was a product of course you would have to look at the costings, the hardware requirements, time to market before deciding on your software architecture. Always plan before coding in my opinion either using UML or block diagrams etc ..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top