When should one use polling method and when should one use interrupt based method ? Are there scenarios in which both can be used ?
Always use a interrupt. That way you never lose data. In event driven or threaded applications even the slowest signals should be interrupt driven.
The only time that you should use polling is when you are using a scheduler and the buffers on your hardware are deep enough to ensure no data loss.
Basically, polled mode is used in case interrupt mode is unavailable due to some hardware or software reasons. So, interrupt mode is more preferable from power consumption, performance, etc points of view (agree with Paul R). Polled mode is also can be used at prototyping, for cores without peripheral needed and for some testing purposes.
Here are few interesting links that i came across while analyzing the polling vs interrupt methods -
http://web.engr.oregonstate.edu/~traylor/ece473/lectures/interrupts.pdf - Very interesting link
http://www.atarimagazines.com/compute/issue149/60_Interrupts_made_easy.php
http://www.electro-tech-online.com/micro-controllers/8440-interrupt-vs-polling.html
http://www.microchip.com/forums/m397196-print.aspx
http://www.cs.huji.ac.il/course/2006/67630/Lectures/interrupts.pdf
http://sunsite.nus.edu.sg/LDP/LDP/tlk/node86.html
Hope this is helpful.
There are many design constraints that can drive the decision. My app has a combination of interrupt and polling:
the short answer is to use the interrupt method when polling is too slow. (by too slow, I mean if polling loses data, the interrupt method is necessary)
If the event of interest is:
then an interrupt based handler would make sense.
If the event of interest is:
then polling might be a better fit.
Other considerations include whether you are writing a device driver for an OS or just writing bare metal code with no thread support. In bare metal situations the CPU is often just looping when it isn't busy so it might as well be polling something.