Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Similar documents
EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1

Microcontrollers. Program organization Interrupt driven I/O. EECE 218 Microcontrollers 1

Microprocessors & Interfacing

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

ECE 372 Microcontroller Design Parallel IO Ports - Interrupts. ECE 372 Microcontroller Design Parallel IO Ports - Interrupts

EE458 - Embedded Systems Exceptions and Interrupts

Fundamental concept in computation Interrupt execution of a program to handle an event

Introduction to Embedded Systems

Introduction to Embedded Systems. Lab Logistics

Interrupts and Low Power Features

INTERRUPTS in microprocessor systems

Digital Control of Electric Drives

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

ECE 485/585 Microprocessor System Design

ECE 341. Lecture # 19

Operating systems and concurrency B02

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

12. Interrupts and Programmable Multilevel Interrupt Controller

Interrupt Lab using PicoBlaze

Reset, Interrupts, Exceptions, and Break ECE 3534

8086 Interrupts and Interrupt Responses:

Programming Embedded Systems

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6

Processor and compiler dependent

Interrupt Lab using PicoBlaze

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places

Timer Module Timer A. ReadMeFirst

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

8051 Interrupt Organization

CHAPTER 11 INTERRUPTS PROGRAMMING

Interrupts CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

Interrupt: (verb) the interruption of a CPU s normal processing...using a mechanism provided for this purpose.

Interrupt/Timer/DMA 1

Lecture 10 Exceptions and Interrupts. How are exceptions generated?

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

Operating systems and concurrency B02

The control of I/O devices is a major concern for OS designers

8051 Microcontroller Interrupts

Chapter 09. Programming in Assembly

ARM Advanced Interrupt Controller

An Operating System in Action

Interrupts, Low Power Modes

CPEG300 Embedded System Design. Lecture 6 Interrupt System

Mark Redekopp, All rights reserved. EE 357 Unit 10b. Interrupts Timers

PC Interrupt Structure and 8259 DMA Controllers

Input/Output. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University

Hardware OS & OS- Application interface

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?)

CSE 153 Design of Operating Systems

Interrupts (Exceptions) Gary J. Minden September 11, 2014

Design and Implementation Interrupt Mechanism

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016

Lecture 5: MSP430 Interrupt

18-349: Introduction to Embedded Real-Time Systems

Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2

Interrupts & Interrupt Service Routines (ISRs)

INPUT/OUTPUT ORGANIZATION

Wireless Sensor Networks (WSN)

INPUT/OUTPUT ORGANIZATION

Interrupt Basics Karl-Ragmar Riemschneider

COSC 243. Input / Output. Lecture 13 Input/Output. COSC 243 (Computer Architecture)

STM32 MICROCONTROLLER

ECE251: Thursday September 27

INPUT/OUTPUT ORGANIZATION

Interrupts in Zynq Systems

Operating System Control Structures

PD215 Mechatronics. Week 3/4 Interfacing Hardware and Communication Systems

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Newbie s Guide to AVR Interrupts

Micro-Controller: PIC16C74 < Part 5: Interrupt >

original M68K requests/priorities Interrupts to execute important code interrupts (n will always be I) I-bits bits in SR accomplish this

Interrupts. Table 1, Interrupt priorities if external handler is used, 0 - highest. coprocessor number 2 exception/interrupt

PEC - Lowering the own Interrupt Priority

Design document: Handling exceptions and interrupts

Exceptions and Interrupts ARM Cortex M3

Chapters 2, 3: bits and pieces. Chapters 2 & 3. Chapters 2, 3: bits and pieces. Chapters 2, 3: bits and pieces. Using C. A last word about hardware

CPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf

ELC4438: Embedded System Design ARM Cortex-M Architecture II

CSE 120 Principles of Operating Systems

Microprocessors and Microcontrollers (EE-231)

Lab 4 Interrupt-driven operations

Last Time. Think carefully about whether you use a heap Look carefully for stack overflow Especially when you have multiple threads

Interrupts Peter Rounce - room 6.18

Process Coordination and Shared Data

Interrupts and Using Them in C

ARM Interrupts. EE383: Introduction to Embedded Systems University of Kentucky. James E. Lumpp

Efficiency and memory footprint of Xilkernel for the Microblaze soft processor

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

Chapter 6 Interrupts. (I. Scott Mackenzie) By: Masud-ul-Hasan

Chapter 7 Central Processor Unit (S08CPUV2)

A First Look at Microprocessors

C02: Interrupts and I/O

Input/Output Programming

Experiment 3. Interrupts. Hazem Selmi, Ahmad Khayyat

Transcription:

Grundlagen Microcontroller Interrupts Günther Gridling Bettina Weiss 1

Interrupts Lecture Overview Definition Sources ISR Priorities & Nesting 2

Definition Interrupt: reaction to (asynchronous) external or internal events external event: button is pressed, certain position is reached,... internal event: timer reaches given value, analog/digital converter has finished conversion,... handled by an Interrupt Service Routine (ISR) ISR interrupts normal program flow 3

Interrupt Sources Many different interrupt sources how do we know which one occured? how do we select the ones we want to react to? how do we react to them? what happens if more than one interrupt at same time? 4

Interrupt Bits Which interrupt occured? > Interrupt Flag (IF) one flag for each interrupt source flag is set if interrupt condition occurs flag is generally cleared upon call of ISR flag can be cleared by program ( > possible to poll flag instead of calling ISR) 5

Interrupt Bits Selecting interrupt sources: interrupt enable (IE) global IE bit: enables/disables all interrupts at once after reset, global IE is disabled useful to disable all interrupts (atomic actions) dedicated IE bits: one for each interrupt source if IE set and interrupt condition occurs > ISR is called 6

Relationship IF / IE: Interrupt Bits IF says that the interrupt condition occured IE says that an ISR should be called controller checks the IF, and if it is set and IE is set, it calls the ISR 7

Non Maskable Interrupts non maskable interrupt (NMI) cannot be disabled for very important events (emergency stop) normally just one or two NMIs not every microcontroller has NMIs 8

Interrupt Service Routine How do we react? > Interrupt Service Routine like a subroutine, but some differences called by CPU, not by program CPU does some things, before ISR is executed exit through special instruction RETI controller must know location of ISR > interrupt vector table 9

Interrupt Vector Table Interrupt Vector Table: consecutive area in program memory has a fixed starting address (often at start of program memory, directly after reset vector) each interrupt source has its own entry entry: either address of ISR, or jump to ISR application program sets up the entries controller uses table to locate & call ISR 10

Reaction to Interrupts Reaction of microcontroller to interrupt: set IF finish current instruction check global and local IE; if both are enabled save PC, possibly some registers (on stack) (globally disable interrupts) (clear IF) jump to ISR interrupt latency (time from IRQ to ISR) 11

Interrupt Latency: Interrupt Latency synchronization delay (1 or more clock cycles) finish current execution (max. exec. time cycles) preparatory stuff (push PC, possibly registers) jump to ISR several clock cycles! not constant! 12

Return From Interrupt Reaction upon return from interrupt: (globally enable interrupts) possibly restore registers, restore PC (from stack) (check if other IF set) continue execution of interrupted program again some clock cycles until program is resumed (constant) 13

Interrupt Priorities More than one interrupt: priorities interrupt with highest priority is serviced first priority often fixed (address in vector table) sometimes, user can specify priorities 14

Nested Interrupts Nested Interrupts set global IE in ISR > new interrupts may interrupt current ISR same actions as with interrupting program number of interruptions > nesting level there must be enough stack space for worst case if only higher priority can interrupt > no infinite nesting level even in case of errors 15

reaction to events IF indicates that interrupt condition has occured reaction controlled with IE bits (1 global IE) interrupt service routine priorities nested interrupts Lecture Summary 16