INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR.

Slides:



Advertisements
Similar presentations
Chapter 3 Basic Input/Output
Advertisements

Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
More fun with Timer/Counters
8051 Core Specification.
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Introduction of Holtek HT-46 series MCU
68HC11 Polling and Interrupts
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
COMP3221: Microprocessors and Embedded Systems Lecture 16: Interrupts II Lecturer: Hui Wu Session 2, 2005.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
CE-2800: Embedded Systems Software I Watchdog Timers 1 The Watchdog timer.
AVR Reset Sources When a reset event occurs.... -I/O registers set to initial values immediately -internal delay stretched to allow power to stabilize.
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Ch. 9 Interrupt Programming and Real-Time Sysstems From Valvano’s Introduction to Embedded Systems.
Slides created by: Professor Ian G. Harris Interrupts  Embedded systems often perform some tasks which are infrequent and possibly unpredictable Hang.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
Lecture 11 Low Power Modes & Watchdog Timers
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.
Timer Timer is a device, which counts the input at regular interval (δT) using clock pulses at its input. The counts increment on each pulse and store.
8051 Micro controller. Architecture of 8051 Features of 8051.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
CS-280 Dr. Mark L. Hornick 1 Atmel Timer/Counter System Most microcontrollers include some type of timer system Facilitates real-time monitoring and control.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.
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.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
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.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Timer and Interrupts.
UNIT – Microcontroller.
Interrupts In 8085 and 8086.
AVR Addressing Modes Subject: Microcontoller & Interfacing
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Reset Sources and Watchdog Timer
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
UNIT 5 TIMRERS/COUNTERS
COMP2121: Microprocessors and Interfacing
Timer/Counter Modified from Dr. Lam Phung’s Slides.
8-bit Timer/Counter0 with PWM
* * * * * * * 8051 Interrupts Programming.
8-bit Timer/Counter2 with PWM and Asynchronous Operation
Lecture 9: TI MSP430 Interrupts & Low Power Modes
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
COMP3221: Microprocessors and Embedded Systems
COMP3221: Microprocessors and Embedded Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR INTTRUPT S 1 NAME EN.NO. ARUN PARMAR NILESH PADHIYAR PATEL ARPIT P GULAM RASOOL PREPARED BY: GUIDED BY: PROF. MADHURI THAKKAR PROF. BHARAT TANK

Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service Routines 2

COMP3221/9221: Microprocessors and Embedded Systems 3 AVR MCU Architecture

4 Interrupts in AVR The number of interrupts varies with specific AVR device. Two types of interrupts: Internal interrupts and external interrupts.  Internal interrupts: Generated by on-chip I/O devices.  External interrupts: Generated by external I/O devices. For most internal interrupts, they don’t have an individual enable/disable bit.  Program cannot enable/disable these interrupts. External interrupts have an individual enable/disable bit.  Program can enable/disable these interrupts.  An external interrupt can be rising edge-triggered, or falling edge- triggered or low level-triggered).  Special I/O registers (External Interrupt Control Registers EICRA and EICRB in Mega64) to specify how each external interrupt is triggered..

5 Interrupts in AVR (Cont.) There is a global interrupt enable/disable bit, the I-bit, in Program Status Register SREG.  Setting the I-bit will enable all interrupts except those with individual enable/disable bit. Those interrupts are enabled only if both I and their own enable/disable bit are set.  The I-bit is cleared after an interrupt has occurred and is set by the instruction RETI.  Programmers can use SEI and CLI to set and clear the I-bit.  If the I-bit is enabled in the interrupt service routine, nested interrupts are allowed. SREG is not automatically saved by hardware when entering an interrupt service routine.  An interrupt service routine needs to save it and other conflict registers on the stack at the beginning and restore them at the end.

6 Interrupts in AVR (Cont.) Reset is handled as a nonmaskable interrupt. Each interrupt has a 4-byte interrupt vector, containing an instruction to be executed after MCU has accepted the interrupt. Each interrupt vector has a vector number, an integer from 1 to n, the maximum number of interrupts. The priority of each interrupt is determined by its vector number.  The lower the vector number, the higher priority. All interrupt vectors, called Interrupt Vector Table, are stored in a contiguous section in flash memory.  Starts from 0 by default.  Can be relocated.

7 Interrupt Vectors Table

8 Interrupt Vectors Table in (Cont.)

9 Interrupt Vectors Table (Cont.)

Watchdog Timer Used to detect software crash. Can be enabled or disabled by properly updating WDCE bit and WDE bit in Watchdog Timer Control Register WDTCR. 8 different periods determined by WDP2, WDP1 and WDP0 bits in WDTCR. If enabled, it generates a Watchdog Reset interrupt when its period expires. So program needs to reset it before its period expires by executing instruction WDR. When its period expires, Watchdog Reset Flag WDRF in MCU Control Register MCUCSR is set.  This flag is used to determine if the watchdog timer has generated a RESET interrupt. 10

Watchdog Timer Logic 11

12 Timer Interrupt Used to schedule (real-time) tasks  Round-Robin scheduling  All tasks take turn to execute for some fixed period.  Real-time scheduling  Some tasks must be started at a particular time and finished by a deadline.  Some tasks must be periodically executed. Used to implement a clock  How much time has passed since the system started? Timer interrupt has many applications:

13 Timer Interrupt (Cont.) Used to synchronize tasks.  Task A can be started only if a certain amount of time has passed since the completion of task B. Can be coupled with wave-form generator to support Pulse- Width Modulation (PWM).  Details to be covered later.

14 Timer Control Register

15 Timer Control Register (Cont.) The mode of operation, i.e., the behavior of the Timer/Counter and the Output Compare pins, is defined by the combination of the Waveform Generation mode (WGM01:0) and Compare Output mode (COM01:0) bits. The simplest mode of operation is the Normal Mode (WGM01:0 = 0). In this mode the counting direction is always up (incrementing), and no counter clear is performed. The counter simply overruns when it passes its maximum 8-bit value (TOP = 0xFF) and then restarts from the bottom (0x00). Refer to Mega64 Data Sheet (pages 96~100) for details.

THANK YOU 16