Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.

Slides:



Advertisements
Similar presentations
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Advertisements

Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
8085 Interrupts LAKSHMI.B.E.1. Interrupts  Interrupt is a process where an external device can get the attention of the microprocessor. ◦ The process.
Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
I/O Unit.
CSCI 4717/5717 Computer Architecture
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
The 8051 Microcontroller and Embedded Systems
Microcontroller Architecture PIC18F Family
INTERRUPTS PROGRAMMING
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
V 0.91 Polled IO versus Interrupt Driven IO Polled Input/Output (IO) – processor continually checks IO device to see if it is ready for data transfer –Inefficient,
Stacks and Subroutines ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Input/Output Ports and Interfacing
MICROPROCESSOR INPUT/OUTPUT
Programming and Problem Solving ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
Application Programs ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Interrupt.
Microprocessors 1 MCS-51 Interrupts.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides an overview of the CPU architecture.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Microprocessor. Interrupts The processor has 5 interrupts. CALL instruction (3 byte instruction). The processor calls the subroutine, address of which.
Chapter 7 Larger Systems and the PIC 16F873A The aims of this chapter are to introduce: The architecture of the 16F873A microcontroller; The 16F873A memory.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
INTRODUCTION TO PIC MICROCONTROLLER. Overview and Features The term PIC stands for Peripheral Interface Controller. Microchip Technology, USA. Basically.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
MICRO-CONTROLLER MOTOROLA HCS12 Interrupts Mechatronics Department Faculty of Engineering Ain Shams University.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
بسم الله الرحمن الرحيم MEMORY AND I/O.
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Polled IO versus Interrupt Driven IO
 The Programmable Interrupt Controller (PlC) functions as an overall manager in an Interrupt-Driven system. It accepts requests from the peripheral equipment,
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
Aum Amriteswaryai Namah:. SUB ROUTINES Instead of repeating same program segments at all locations, they are written and stored separately; Each such.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Lecture – 8 Interrupt 1. Outline Introduction Handling interrupt Interrupt sources Switching interrupt Peripheral interrupts Using two interrupts Conclusions.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
An Introduction to Embedded Systems, and the PIC Microcontroller Lecture 8: Interrupts The aims of this session are to explore the structure and application.
Microprocessor and Microcontroller Fundamentals
8085 Interrupts LAKSHMI.B.E..
MICROPROCESSOR BASED SYSTEM DESIGN
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
The process starts from the I/O device
UNIT – Microcontroller.
Computer Architecture
Interrupts In 8085 and 8086.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Dr. Michael Nasief Lecture 2
Interrupt.
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
8259 Programmable Interrupt Controller
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
PIC18 Interrupt Programming
COMP3221: Microprocessors and Embedded Systems
Figure Simplified View of Interrupts (default for power-on reset)
PIC18 Interrupt Programming
Presentation transcript:

Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning

Basic Concepts of Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which: An internal or external device requests the MPU to stop the processing The MPU acknowledges the request Attends to the request Goes back to processing where it was interrupted 2330_10

Types of Interrupts 3330_10

MPU Response to Interrupts  When the interrupt process is enabled, the MPU checks the interrupt request flag just before the end of each instruction.  If the interrupt request is present, the MPU: Completes the execution of the instruction Resets the interrupt flag Saves the address of the program counter on the stack  To restart the execution, the MPU needs to be redirected to the memory location where the interrupt request can be met. Accomplished by interrupt vectors  The set of instructions written to meet the request is called an interrupt service routine (ISR).  Once the request is accomplished, the MPU should find its way back to the next instruction, where it was interrupted. Accomplished by a specific return instruction 4330_10

PIC18 Interrupts  PIC18 Microcontroller family Has multiple sources that can send interrupt requests Does not have any non-maskable or software interrupts All interrupts are maskable Has a priority scheme divided into two groups High priority and low priority Uses many Special Function Registers (SFRs) to implement the interrupt process 5330_10

PIC18 Interrupt Sources  External sources Three pins of PORTB -RB0/INTO, RB1/INT1,and RB2/INT2 These pins can be used to connect external interrupting sources such as keyboards or switches Change in logic levels of pins RB4-RB7 of PORTB can be recognized as interrupts  Internal peripheral sources Examples: Timers, A/D Converter, Serial I/O, and Low- Voltage Detection Module 6330_10

PIC18 Interrupt Sources  Special Function Registers (SFRs) RCON register sets up global priority. INTERCON registers deal primarily with external interrupt sources. PIR, PIE, and IPR handle internal peripheral interrupts.  To recognize the occurrence of an interrupt request, the MPU needs to check the following three bits: The flag bit to indicate that an interrupt request is present The enable bit to redirect the program execution to the interrupt vector address The priority bit (if set) to select priority 7330_10

Interrupt Priorities  Any interrupt can be set up as high- or low-priority High-priority interrupt vector location H. Low-priority interrupt vector location H. A high-priority interrupt can interrupt a low-priority interrupt in progress. The interrupt priority feature is enabled by Bit7 (IPEN) in RCON register. 8330_10

External Interrupts  INTERCON Register  INTCON2 Register  INTCON3 Register 9330_10

Interrupt Service Routine (ISR)  Similar to a subroutine  Attends to the request of an interrupting source Clears the interrupt flag Should save register contents that may be affected by the code in the ISR Must be terminated with the instruction RETFIE  When an interrupt occurs, the MPU: Completes the instruction being executed Disables global interrupt enable Places the address from the program counter on the stack 10330_10

Interrupt Service Routine (ISR)  RETFIE [s];Return from interrupt If s =1, the MPU also retrieves the contents of W, BSR, and STATUS register before enabling the global interrupt bit.  In high-priority interrupts: The contents of W, STATUS, and BSR registers are automatically saved into respective shadow registers. RETFIE 1 (or RETFIE FAST) retrieves the contents of these registers.  In low-priority interrupts: These registers must be saved as a part of an ISR if these registers are affected by the code in the ISR _10

Internal Interrupts  The PIC18 MCU includes many internal devices such as the timers and the A/D converter that can interrupt the MPU.  Each interrupt is associated with three bits Priority, interrupt request flag, and enable (similar to the that of external interrupts)  Registers associated with the internal interrupts IPR:Interrupt Priority Register PIE:Peripheral Interrupt Enable PIR:Peripheral Interrupt Request (Flag) 12330_10

Interrupt Registers  IPR1  PIE1  PIR _10

Multiple Interrupt Sources  In PIC18 MCU, all interrupt requests are directed to one of two memory locations: H (high-priority) H (low-priority)  When multiple requests are directed to these locations, the interrupt source must be identified by checking the interrupt flag through software instructions _10

Illustration  Problem Statement Set up INT1 as a high-priority interrupt Set up Timer1 and Timer2 as low-priority interrupts 330_0915

Illustration 330_0416 LabelOpcodeOperandComments REG1EQU0x01 STATUS_TMPEQU0x100;Temp Registers WREG_TMPEQU0x101 ORG0x00 GOTOMAIN ORG0x00008;High-Priority Interrupt Vector INTCHK:GOTOINT1_ISR ORG0x00018;Low-Priority Interrupt Vector TIMERCHK:BTFSCPIR1,TMR1IF;Timer1 Flag, Skip if Clear GOTOTMR1_ISR BTFSCPIR1,TMR2IF;Timer2 Flag, Skip if Clear GOTOTMR2_ISR

Illustration 330_0417 LabelOpcodeOperandComments MAIN:;Main Program goes here ;Do Something HERE:GOTOHERE;Wait for an Interrupt ORG0x100 INT1_ISR:BCFINTCON3,INT1IF ;Clear Flag ;Do Something RETFIEFAST;Retrieve registers and Return

Illustration 330_0418 LabelOpcodeOperandComments TMR1_ISR:MOVFFSTATUS, STATUS_TMP MOVWFWREG_TMP;Save Registers BCFPIR1,TMR1IF;Clear Flag ;Do Something MOVFWREG_TMP,W ;Retrieve Registers MOVFFSTATUS_TMP,STATUS RETFIE ;Return from interrupt TMR2_ISR ;Similar to Timer1