Lecture_07 - Interrupts

Lecture_07 - Interrupts - SEE215 Lecture 7 Interrupts...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Faculty of Science and Technology Lecture 7 Interrupts SEE215
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background to Interrupts Life often involves interruptions. We are often interrupted by phone calls, someone knocking on the door, a fire alarms, etc. etc. Interruptions can often be a nuisance, but also many times can they can be so important that they should not be ignored. It is better to have a phone interrupt us by ringing rather then, have to pick up the phone every few minutes to check just in case someone has called us. So, in life we manage interrupts which might occur, so that we can get on with our life, but we still allow the opportunity for ourselves to be interrupted by important events that we wish or must attend to. After we are interrupted, we resume the task before we were interrupted. Sometimes we may turn the phone off or put a “do not disturb” sign on our door to avoid any interrupt. What does this have to do with microcontrollers?
Background image of page 2
Interrupts in microcontrollers A micro controller may have many tasks to perform, which all require certain amount of time to complete. Some of these might be mundane tasks, which are relatively non-time critical. IE. Flashing a LED, or writing data to a terminal, turning a pump ON or OFF. Some events however may be extremely time critical, which may be one off events, such as a key press, a character received from a terminal or some other time critical task needs to be performed. We need to take this into account when we design our programs, so that whilst the mundane and non-critical tasks must always completed, when a a time critical event occurs, the current task should be suspended temporarily, priority give to the interrupt task and then the suspended task resumed. Interrupts are so important, that all microcontrollers have a structure that allow for interrupts.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
polling inputs vs. interrupts CPU ACTIVITY main task waits for a key press When key press detected causes activity. The main processing time is involved with detecting a change. Processor 99.9% occupied doing an extremely simple task, which is better handled by an interupt. poll for next key etc. Main continuously polls a key input to determine if an activity is required
Background image of page 4
main and interrupt tasks Main task Interrupt handler CPU ACTIVITY Main task Suspended at interrupt Main task resumed after Interuption handled When a input change is detected, the main task is interrupted briefly, while some activity occurs & then main task is resumed. The interrupt tasks are usually so short, that the suspension of the main task is not really noticed. The main task can now do more complex tasks instead of polling an input.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interrupts in AVR ATMega 128 The ATMega128 processor has the ability to be interrupted by different events. The reset condition is highest priority interrupt! The reset cannot be disabled. The reset is a special interrupt and few of the following comments apply to the reset interrupt.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

Lecture_07 - Interrupts - SEE215 Lecture 7 Interrupts...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online