External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.

Slides:



Advertisements
Similar presentations
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. A7: Bahasa Rakitan AVR Interrupt Handler 25 April 2003 Bobby Nazief Qonita Shahab.
Advertisements

Interrupts Professor Yasser Kadah –
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
8051 Core Specification.
Analog to Digital Conversion
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Introduction of Holtek HT-46 series MCU
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
Intro to AVR ATtiny2313 CS423 Dick Steflik. AVR ATtiny2313.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
INTERRUPTS PROGRAMMING
NS Training Hardware. System Controller Module.
Input/Output mechanisms
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,
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
A Few Words From Dilbert
MSP430 Mixed Signal Microcontroller – Parte 2 Afonso Ferreira Miguel Source: slau056d – Texas instruments.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
PIC16F877 ISR Points to note Interrupt Triggers –Individual interrupt flag bits are set, regardless of the status of their corresponding mask bit, PEIE.
بسمه تعالي AVR Microcontrollers. The ATmega8 Basic Features -1.
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.
Lecture 22 IO & data transfer Methodolodies –Polled, Interrupt Driven, DMA Interrupts –AVR Interrupts (RISC) –68HC11 Interrupts (CISC) IBM PC Boot Sequence.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
AVR Programming: Interrupts September 17, What are interrupts? An asynchronous signal indicating the need for an event to be handled A synchronous.
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.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
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.
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.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
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.
Timers and Interrupts Mark Neil - Microprocessor Course.
Chapter 5 - Interrupts.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
Renesas Electronics America Inc. © 2011 Renesas Electronics America Inc. All rights reserved. RX Interrupt Control Unit (ICU) Ver
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 Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Special Features. Device Configuration bits Revision Device Configuration bits Revision On-chip Power-on Reset (POR) Revision On-chip Power-on Reset (POR)
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
Embedded Systems Programming
Power Management and Sleep Modes
Power Management and Sleep Modes
UNIT – Microcontroller.
BITS EDU. CAMPUS , VARNAMA
AVR Addressing Modes Subject: Microcontoller & Interfacing
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Interrupt Source: under
The Arduino Microcontroller: Atmel AVR Atmega 328
Interrupt and Exception Programming
ATmega103 Timer0 and Interrupts
* * * * * * * 8051 Interrupts Programming.
AVR – ATmega103(ATMEL) Architecture & Summary
8051 Micro Controller.
Interrupt Chapter 10.
Presentation transcript:

External & internal Interrupts

Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at the start of the memory space. 3 external interrupts (INT0, INT1 and INT2) are available at pins PD2(pin 16) and PD3 (pin 17) and PB2 (pin 3). They are Edge or Level triggered interrupts (except Int2 which is only edge triggered). Reset input (pin 9) which causes also an interrupt and can be both externally and internally initiated. If enabled, the interrupts will trigger even if the INT0 and INT1 pins are configured as outputs. This feature provides a way of generating a software interrupt (how?). INT0, INT1 (level) and INT2 are detected asynchronously (no Clock needed and thus they can be used to get the µC from sleep modes.

Reset and Interrupt Vectors Vector No. Program Address Source InterruptDefinition 1 $000RESET External Pin, Power-on Reset, Brown-out Reset, Watchdog Reset, and JTAG AVR Reset 2 $002 INT0 External Interrupt Request 0 3 $004 INT1 External Interrupt Request 1 4 $006 TIMER2 COMP Timer-Counter2 Compare Match 5 $008 TIMER2 OVF Timer-Counter2 Overflow 6 $00A TIMER1 CAPT Timer-Counter1 Capture Event 7 $00C TIMER1 COMPA Timer-Counter1 Compare Match A 8 $00E TIMER1 COMPB Timer-Counter1 Compare Match B 9 $010 TIMER1 OVF Timer-Counter1 Overflow

Vecto r No. Program Address Source InterruptDefinition 10 $012 TIMER0 OVF Timer-Counter0 Overflow 11 $014 SPI, STC Serial Transfer Complete 12 $016 USART, RXC USART, Rx Complete 13 $018 USART, UDRE USART Data Register Empty 14 $01A USART, TXC USART, Tx Complete 15 $01C ADC ADC Conversion Complete 16 $01E EE_RDY EEPROM Ready 17 $020 ANA_COMP Analog Comparator 18 $022 TWI Two-wire Serial Interface 19 $024 INT2 ExternalInterrupt Request 2 20 $026 TIMER0 COMP Timer-Counter0 Compare Match 21 $028 SPM_RDY Store Program Memory Ready

Notes to interrupt vector table If the program never enables an interrupt source, the Interrupt Vectors are not used, and regular program code can be placed at these locations.

External Interrupts: To enable INT0/INT1/INT2: The I-bit in the Status Register must be set. But also the corresponding External Interrupt Request Enable bit in the General Interrupt Control Register (GICR) When an event on the INT0/INT1/INT2 pin triggers an interrupt request, INT0-Flag/INT1-Flag/INT2-Flag (bit 6/7/5 of the General Interrupt Flag Register – GIFR) becomes set. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. General Interrupt Flag

Interrupt Triggering The external interrupts INT0/INT1 can be triggered by a falling or rising edge or a low level.

INT2 The external interrupts INT2 can only be triggered by a falling or rising edge. ISC2 (interrupt sense control of INT2): ISC2 = 0 -> Falling Edge ISC2 = 1 -> Rising Edge MCU Control and Status Register

Using Interrupts in C The access to the AVR interrupt system is implemented with the interrupt keyword. Examples: interrupt [2] void external_int0(void) { /* Place your code here */ RETI } interrupt [10] void timer0_overflow(void) { /* Place your code here */ RETI }

Using Interrupts in C (Contd.) Interrupt vector numbers start with 1. The compiler will automatically save the affected registers when calling the interrupt functions and restore them back on exit. a RETI assembly instruction is placed at the end of the interrupt function. Interrupt functions can't return a value nor have parameters. You must also set the corresponding bits in the peripheral control registers to configure the interrupt system and enable the interrupts.

Using the CodeVisionAVR Wizard by interrupts

Including Assembly Lines in the Program Inline assembly may also be used. Example: #asm("sei") /* enable interrupts */ You can include assembly language anywhere in your program using the #asm and #endasm directives. Example: void delay(unsigned char i) { while (i--) { /* Assembly language code sequence */ #asm nop #endasm }; }