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

Slides:



Advertisements
Similar presentations
Interrupts How to do 2 things at the same time. Need for interrupts Computers often have to deal with asynchronous events. That is to say events that.
Advertisements

Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. A6: Bahasa Rakitan AVR I/O Instructions 4 April 2003 Bobby Nazief Qonita Shahab.
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 19: I/O, Interupsi 20 November 2002 Bobby Nazief Johny Moningka
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 19: I/O, Interupsi pada AVR 22 November 2002 Bobby Nazief Johny Moningka
AT94 Training 2001Slide 1 FPSLIC- Embedded MCU Core 8 Bit RISC MCU Industry’s Highest 8-bit Performance A Real 8-Bit RISC Architecture Low Power ( idle/power.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 11: Control Unit Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization, ed-5.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 08: Multi-module Programs Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
A look at interrupts What are interrupts and why are they needed.
I/O Unit.
Computer System Overview
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
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.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
A look at interrupts What are interrupts and why are they needed.
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.
INTERRUPTS PROGRAMMING
Introduction to AVR (Atmega 16/32)
Embedded Systems 7763B Mt Druitt College of TAFE
COMP201 Computer Systems Exceptions and Interrupts.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
A Few Words From Dilbert
CoE3DJ4 Digital Systems Design Chapter 6: Interrupts.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Interrupt.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
Microprocessors 1 MCS-51 Interrupts.
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.
Interrupts An interrupt is an exception, a change of the normal progression, or interruption in the normal flow of program execution. An interrupt is essentially.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
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.
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.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
kashanu.ac.ir Microprocessors Interrupts Lec note 8.
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.
An Introduction to Embedded Systems, and the PIC Microcontroller Lecture 8: Interrupts The aims of this session are to explore the structure and application.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Microprocessor and Assembly Language
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Interrupts In 8085 and 8086.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
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.
Interrupt and Exception Programming
ATmega103 Timer0 and Interrupts
Computer System Overview
Interrupt Source: under
Interrupt Source: under
Interrupt Chapter 10.
Computer System Overview
COMP3221: Microprocessors and Embedded Systems
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

1 IKI10230 Pengantar Organisasi Komputer Kuliah no. A7: Bahasa Rakitan AVR Interrupt Handler 25 April 2003 Bobby Nazief Qonita Shahab bahan kuliah: Sumber: 1. AVR AT90S8515 Data Sheet. 2. Materi kuliah CS152, th. 1997, UCB.

2 Interrupt Handler

3 Enabling/Disabling Interrupt (1) °When an interrupt occurs, the Global Interrupt Enable I- bit is cleared (zero) and all interrupts are disabled. The user software can set (one) the I-bit to enable nested interrupts (risky!). The I-bit is set (one) when a Return from Interrupt instruction – RETI - is executed. °Instructions: SEI, CLI

4 Enabling/Disabling Interrupt (2) °The AT90S4414/8515 has two 8-bit Interrupt Mask control registers: GIMSK - General Interrupt Mask register to enable/disable external interrupts TIMSK - Timer/Counter Interrupt Mask register to enable/disable timer/counter interrupt

5 Remembering Interrupt °The AT90S4414/8515 has two 8-bit Interrupt Flag registers: GIFR - General Interrupt Flag register to remember external interrupts whenever it is being disabled TIFR - Timer/Counter Interrupt Flag register to remember timer/counter interrupt whenever it is being disabled

6 When Interrupt is Set - SEI °If the interrupting condition occurs, e.g. a change on the port bit, the processor pushes the actual program counter to the stack °After that, processing jumps to the predefined location, the interrupt vector, and executes the instructions there. Usually this is a JUMP instruction to the interrupt service routine somewhere in the code. The interrupt vector is a processor-specific location and depending from the hardware component and the condition that leads to the interrupt °The service routine must re-enable this flag after it is done with its job. The service routine can end with the command: RETI

7 Interrupt Vector Vec NoPrg AdrSourceInterrupt Definition 1 $000 RESET Hardware Pin, Power-on Reset and Watchdog Reset 2 $001 INT0 External Interrupt Request 0 3 $002 INT1 External Interrupt Request 1 4 $003 TIMER1CAPT Timer/Counter1 Capture Event 5 $004 TIMER1COMPATimer/Counter1 Compare Match A 6 $005 TIMER1COMPB Timer/Counter1 Compare Match B 7 $006 TIMER1OVF Timer/Counter1 Overflow 8 $007 TIMER0,OVF Timer/Counter0 Overflow 9$008SPI, STCSerial Transfer Complete 10 $009 UART, RX UART, RX Complete 11 $00A UART, UDRE UART Data Register Empty 12 $00B UART, TX UART, TX Complete 13 $00C ANA_COMP Analog Comparator Prioritas Tertinggi

8 Interrupt Vector Initialization Address CodeComments $000 rjmp RESET ; Reset Handler $001 rjmp EXT_INT0 ; IRQ0 Handler $002 rjmp EXT_INT1 ; IRQ1 Handler $003 rjmp TIM1_CAPT ; Timer1 Capture Handler $004 rjmp TIM1_COMPA ; Timer1 CompareA Handler $005 rjmp TIM1_COMPB; Timer1 CompareB Handler $006 rjmp TIM1_OVF; Timer1 Overflow Handler $007 rjmp TIM0_OVF; Timer0 Overflow Handler $008 rjmp SPI_STC; SPI Transfer Complete Handler $009rjmp UART_RXC ; UART RX Complete Handler $00a rjmp UART_DRE ; UDR Empty Handler $00b rjmp UART_TXC ; UART TX Complete Handler $00c rjmp ANA_COMP ; Analog Comparator Handler

9 Kerangka Program rjmp RESET rjmp EXT_INT0 RESET: ;init stack pointer ;init any ports used ;other init sei ;do things, main loop, etc EXT_INT0: ;do things reti

10 Contoh: Main Program.cseg.org INT0addr rjmpext_int0;External interrupt handler.org OVF0addr rjmptim0_ovf;Timer0 overflow handler main: Do some initializations rcalluart_init;Init UART sei;Enable interrupts idle: sbrsu_status,RDR;Wait for Character rjmpidle Do the work wait: sbrcu_status,TD;Wait until data is sent rjmpwait Wrap it up

11 Contoh: Interrupt Handler ext_int0: ldiu_status,1<<BUSY;Set busy-flag (clear all others) Do some work ldiu_tmp,1<<TOIE0;Set bit 1 in u_tmp outTIFR,u_tmp; to clear T/C0 overflow flag outTIMSK,u_tmp; and enable T/C0 overflow interrupt Do more work clru_bit_cnt;Clear bit counter outGIMSK,u_bit_cnt;Disable external interrupt reti tim0_ovf: sbrsu_status,TD;if transmit-bit set Do something ldiu_tmp,1<<INT0;(u_bit_cnt==9): outGIMSK,u_tmp;Enable external interrupt clru_tmp outTIMSK,u_tmp;Disable timer interrupt cbru_status,(1<<BUSY)|(1<<TD) ;Clear busy-flag and transmit-flag reti

12 Referensi °AVR Assembler User Guide ° °Contoh program: int-exmp.asm