嵌入式系统教案-中断(全英)

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• When issue one occurs, stop and attend to it • When issue two occurs, stop and attend to it
• When issue n occurs, stop and attend to it
• Requires a method of stopping the normal program flow to jump to attend to the priority task
done state transition) – Can be used to wake periodically from ‘sleep’ saving
power
Dealing with Interrupts
• Do nothing (i.e. wait until something happens)
wait a considerable time to be serviced • Hybrid schemes are possible (execute at
most k tasks before restarting, Round Robin for secondary tasks with prioritised return to important tasks
asking the user to ‘Press any key to continue) • Two main options – Polling loops or Interrupts
Polling Loop
Polling is a method where the processor checks to see if components need attention/servicing. Different ways of checking exist.
Task1
Task5
Task2
Task4
Task3
Polling Strategies - Prioritised
• Tasks listed in priority order • Processor returns to the start after
attending to a task • Disadvantage is that low priority tasks may
• There is no separate operating system - there is nowhere for the program to return to
• The program will run • All errors/exceptions must be handled (NOT by
Question:
In Lab 2, you did not use interrupts, where would they have helped?
Program Flow
• Unlike a general purpose computer, the program in an embedded processor is unlikely to be changed
– external I/O device (like a keyboard or printer) or – an internal event (like an op code fault, or a periodic
timer.) – occurs when the hardware needs service (busy to
• High priority tasks served by interrupts • Important to keep track of who is doing
EE312 Instrumentation and Microcontrollers
Lecture 3: Interrupts
What you will learn
• What the difference is between interrupts and polling
• When to use interrupts • How to use interrupts from C
Interrupts
• An interrupt is the automatic transfer of software execution in response to events (from hardware) that are asynchronous with the current software execution.
Hybrid Systems
• Most embedded systems combine polling loop and interrupt systems
• Polling loop replaces ‘do nothing’ as the background task in the interrupt scheme, dealing with low priority tasks
• Check issue one and attend to as necessary • Check issue two and attend to as necessary
• Check issue n and attend to as necessary
START AGAIN
Polling Strategies - Round Robin
• In a round robin scheme, the processor goes through each task in turn, attending to them as necessary
• All tasks have the same priority
• Can take some time to get back to a task if all the other tasks require attention
相关文档
最新文档