AGH University of Science and Technology Cracow Department of Electronics
|
|
- Robert Webster
- 6 years ago
- Views:
Transcription
1 AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek ver. 01/07/14 1/12
2 1. Introduction 1.1. Objectives The goal of this tutorial is to present the concept of interrupts and interrupts programming in AVR family of microcontrollers. The major advantages of interrupts will be highlighted at the beginning. Then possible interrupt sources in ATMega32 will be given. Interrupt subsystem and registers will be introduce later. Special focus on timer interrupts and external interrupts will be done. Some hands on exercises will be proposed for students Prerequisites The AVR programming tutorials 1, 2, 3, 4, 5 and 6 should be completed before reading this tutorial Preparing ZL2AVR board 2. Interrupts basics 2.1. Interrupts vs. polling So far we had to test for certain events ourselves. For example to determine wether a button is pressed we tested the appropriate bit in PinX register. This method is called polling. In polling, the microcontroler continuously monitors the status of a given device (e.g. button). The polling is not an efficient way to use a microcontroller because the polling procedure wastes the most of processors time and systems electrical energy. The alternative approach is an interrupt procedure. In interrupt method the devices that requests microcontroller service notifies the microcontroller by driving an interrupt signal. Upon receiving an interrupt signal, the microcontroler stops whatever it is doing and starts to execute a program associated with the interrupt. The program is called interrupt service routine (ISR) or interrupt handler. In oppose to polling, interrupts allow to introduce priorities. So when more the one event occurs at a time, the one with the highest priority is serviced first Steps in executing an interrupt Upon activation of an interrupt, the microcontroller: 1. finishes the instruction it is currently executing and saves the address of the next instruction on the stack, 2. jumps to the interrupt vector table which directs the microcontroller to the address of ISR, 3. executes ISR until it reaches the last instruction of the routine, which is return from interrupt (reti) instruction. 4. Upon executing reti instruction, the microcontroller returns to the place where it was interrupted. It restores the program counter from the stack and executes from that address. 2/12
3 Note From the critical role of the stack in servicing the interrupts (and other routines), we must be careful in manipulating the stack content in the ISR. The number of push and pop instruction throughout ISR must be equal. Similarly, every register used in ISR should be pushed at the beginning of the ISR and then poped at its end in order that the ISR does not interfere with the standard procedures. 3. AVR interrupts sources There are a number of events which can automaticly alert us when they occur. Every interupt source must have an interrupt service routine. In AVRs for every interrupt there is a fixed location in memory that holds the address of its ISR. The group of memory locations set aside to hold the addresses of ISRs is called the interrupt vector table. Excerpt of the interrupt vector table for ATMega32 is given below. Interrupt Reset $0000 EEPROM location.equ label External Interrupt request 0 $0002 INT0addr External Interrupt request 1 $0004 INT1addr External Interrupt request 2 $0006 INT2addr Timer/Counter2 Compare Match $0008 OC2addr Timer/Counter2 Overflow $000A OVF2addr Timer/Counter1 Capture Event $000C ICP1addr Timer/Counter1 Compare Match A $000E OC1Aaddr Timer/Counter1 Compare Match B $0010 OC1Baddr Timer/Counter1 Overflow $0012 OVF1addr Timer/Counter0 Compare Match $0014 OC0addr Timer/Counter0 Overflow $0016 OVF0addr The most typical and general program setup for the Reset and selected Interrupt Vector Addresses in ATmega32 can look like the code below. It handles External Interrupt request 0 interrupt, Timer/Counter0 Compare Match interrupt, and Timer/Counter0 Overflow interrupt. Other interrupts handlers can be added when required according the above table. Example..include "m32def.inc".org 0 jmp reset.org INT0addr ; External Interrupt Request 0.org OC0addr jmp external_interrupt_0 ; Timer/Counter0 Compare Match 3/12
4 jmp timer0_compare_match.org OVF0addr jmp timer0_overflow reset: ldi r16,high(ramend) out SPH,r16 ldi r16,low(ramend) out SPL,r16 ;... some code external_interrupt_0: ;... some code reti timer0_compare_match ;... some code reti timer0_overflow: ;... some code reti ; Timer/Counter0 Overflow ; Main program start ; Set Stack Pointer to top of RAM 4. Enabling and disabling interrupts globally Each interrupt can be disabled (masked). That means that it will not be responded by the microcontroller. The interrupts must be enabled (unmasked) by software in order for microcontroller to respond to them. The bit D7 of the status register (sreg) is responsible for enabling and disabling the interrupts globally. The bit is called interrupt bit i. See figure for bits of the status register. Bit sreg i 4.1. Set interrupts (sei) instruction Sets the Global Interrupt Flag (i) in sreg (Status Register). The instruction following sei will be executed before any pending interrupts. sei ; set global interrupt enable 4.2. Clear interrupts (cli) instruction Clears the Global Interrupt Flag (i) in sreg (Status Register). The interrupts will be immediately disabled. No interrupt will be executed after the cli instruction, even if it occurs 4/12
5 simultaneously with the cli instruction. With single cli, we can make i-0 during operation of critical task. cli ; disable all interrupts 4.3. Sleep instruction This instruction sets the circuit in sleep mode sleep ; put MCU in sleep mode Example: sei ; set global interrupt enable sleep ; enter sleep, waiting for interrupt 5. Timer interrupts In tutorial 6 we learn how to use timer 0 and timer 1 with polling method. For example we could examine tov0 bit with the sbrs instruction to monitor timer 0 overflow. Similarly we could examine ocf0 bit to monitor timer 0 compare match occurrence. These methods tied down microcontroller. With a timer interrupt we can avoid tying down the controller. To enable timer overflow interrupt, timer overflow interrupt enable (toien) bit of timer interrupt mask (timsk) register, must be set. To enable timer compare match interrupt, output compare match interrupt enable (ocien) bit of timsk register, must be set. Example ldi r20, (1<<toie0) out timsk, r20 ;enable Timer0 overflow interrupt 5.1. Timer interrupt mask (timsk) register Bit timsk ocie2 toie2 ocie1a ocie1b toie1 ocie0 toie0 ocie2 D7 Timer/Counter2 Output Compare Match Interrupt Enable toie2 D6 Timer/Counter2 Overflow Interrupt Enable ocie1a D4 Timer/Counter1, Output Compare A Match Interrupt Enable ocie1b D3 Timer/Counter1, Output Compare BMatch Interrupt Enable toie1 D2 Timer/Counter1, Overflow Interrupt Enable ocie0 D1 Timer/Counter0 Output Compare Match Interrupt Enable toie0 D0 Timer/Counter0 Overflow Interrupt Enable 5/12
6 Exercise 7.1 Taking that the system clock of your ATMega processor is 1MHz and using Timer1 write and run a program that toggle the LED every one second. Utilize compare match interrupt capability of tier 1. Tip: Use timer1_1sec.asm program from tutorial 6 as a starting point to build a solution. Save the program as timer1_1sec_int.asm when you finish. Exercise 7.2 Write a program that counts how many times a push button is pressed. In this exercise you must propose button debouncing solution. Hints. 1. Use timer 0 interrupt to read buttons state every 5ms. 2. In the interrupt procedure copy pin state to general purpose register. Use the general purpose register in the main program loop to analyse the current pin state. 3. To account a single button event, detect when the button is pressed but wait until the button is released to complete the cycle. 6. External interrupts There are three external hardware interrupts in ATMega32: Int0, Int1, and Int2. They are located on selected ports' pins. These interrupts must be enabled before they can take effect. This is done using the intn bit located in the gicr register. Ext. interrupt Pin location Int. vector location Enable bit location Int0 Port D.2 $0002 gicr.6 Int1 Port D.3 $0004 gicr.7 Int2 Port B.2 $0006 gicr.5 Example ldi r20, (1<<int0) ;enable external interrupt 0 out gicr, r General Interrupt Control (gicr) register Individual external interrupts can be enabled using bits in General Interrupt Control Register (gicr). Bit /12
7 gicr int1 Int0 int2 int1 D7 =0 disabled external interrupt 1 =1 enables external interrupt 1 int0 D6 =0 disabled external interrupt 0 =1 enables external interrupt 0 int2 D5 =0 disabled external interrupt 2 =1 enables external interrupt 2 These bits, along with bit I, must be set high for interrupt to be responded to Edge-triggered vs. level-triggered interrupts Int2 is only edge triggered, while Int0 and Int1 can be programmed to be edge or level triggered. In the case of level triggered interrupts, if we want the ISR to be executed only once, the interrupt pin must be brought back to inactive state before reti is executed. Upon reset Int0 and Int1 are low-level-triggered interrupts. If we want to change trigger mode we should program associated Interrupt Sense Control (isc) bits in mcucr register. Bit mcucr isc11 isc10 isc01 isc00 Isc01 and isc00 bits are responsible for Int0 triggering mode. isc01 isc00 Description 0 0 Low-level of Int0 pin 0 1 Any logical change on Int0 pin 1 0 Falling edge of Int0 pin 1 1 Rising edge of Int0 pin Isc11 and isc10 bits are responsible for Int1 triggering mode. isc11 isc10 Description 0 0 Low-level of Int1 pin 0 1 Any logical change on Int1 pin 1 0 Falling edge of Int1 pin 1 1 Rising edge of Int1 pin Isc2 bit of mcucsr register defines whenever the Int2 interrupts activate on falling or rising edge. 7/12
8 Bit mcucsr isc2 isc2 Description 0 Falling edge of Int2 pin 1 Rising edge of Int2 pin Example ;make Int0 rising-edge active ldi r20, (1<<isc01) (1<<isc00) out mcucr, r General Interrupt Flag (gifr) register The gifr register contains the interrupt flags for all the ATMega external interrupts. Each of these bit are set individually to logic 1 when the interrupt event for the specified interrupt occurs. Note that the flag bit of an interrupt is set, whether or not the interrupt is enabled, once the interrupt event occurs. In order to cancel any previous external events, the flags should be cleared when an external interrupt is enabled. Bit gifr intf1 intf0 intf2 The intf0, intf1, and intf2 flags are set when respective interrupt is pending. This flags are clear automatically after the interrupt service routine is called. The flags can also be cleared by a bit set operation in the gifr register. Example ;clear intf1 flag ldi r20, (1<<intf1) out gifr, r20 7. ZL3AVR keypad revisited So far we used small keypad mode of the ZL2AVR's keypad in our tutorial (JP3 jumper was closed). Now it is time to start using the full functionality of the keypad. We want to be able to read all 16 buttons. We must develop a special procedure to do so, as buttons of the keypad are arranged in 4 4 matrix. To decode which button is pressed we must determine both active column and active row of 8/12
9 the keypad. To read which columns is active we must set row lines (W1..W4) as outputs and column line (K1..K4) as inputs. We set low state on row lines and read column lines. The column line which state is low is active. To read which row is active we must set column lines (K1..K4) as outputs and row lines (W1..W4) as inputs. We set low state on column lines and read row lines. The row line which state is low is active. Now we must combine the row and the column to deliver the keypad button code. Additionally the key pad is able to generate logic signal when some button is pressed. The signal can be used to generate external interrupt. If row lines (W1..W4) are set as output and they are at low state, the signal on JP13 becomes low when any button is pressed. Exercise 7.3 Write a program which reads a pressed keypad button. Use external interrupt to trigger reading procedure. Output a keypad button code on LED controls. To simplify your program you can assume that button code consist of a row code on high nibble and column code on lower nibble. The row and column code can be 'one cold' encoding (inversion of one hot encoding) Column code (one cold) Row code (one cold) Row no. Code Column no. Code 1 '0111' 1 '0111' 2 '1011' 2 '1011' 3 '1101' 3 '1101' 4 '1110' 4 '1110' 9/12
10 Connect LEDs control to Port A, and the keypad to port D. Port A.0=D0 Port A.1=D1 Port A.2=D2 Port A.3=D3 Port A.4=D4 Port A.5=D5 Port A.6=D6 Port A.7=D7 Port D.0=K4 Port D.1=K3 Port D.2=K2 Port D.3=K1 Port D.4=W4 Port D.5=W3 Port D.6=W2 Port D.7=W1 Use external interrupt Int2 to start keypad reading routine. Ensure, that the clock source of ATMega is set to the default 1MHz internal oscillator. The proposal of the assembly program template for the exercise is given below..include"m32def.inc".cseg.org 0 jmp start.org INT2addr jmp keypad_isr ;Keyoad External Interrupt Request 2.def button_code=r20 ; Main program start start: ; Set Stack Pointer to top of RAM ;Set up port A as output for LED controls ; Clear intf2 flag ldi r16, out gifr, r16 ; Enable Int2 ldi r16, out gicr, r16 ; Set Int2 active on falling edge ldi r16, 10/12
11 out mcucr, r16 ;Set rows as inputs and columns as outputs ;Set rows to high (pull ups) and columns to low to activate JP13 ;Global Enable Interrupt ;Set up infinite loop loop: ;read button code from r20 and send to port A rjmp loop ;Keypad Interrupt Service Routine keypad_isr: ;Disable interrupts ;Store registers that are to be used in ISR on stack ;Set rows as outputs and columns as inputs on Port D ;Set rows to low and columns to high (pull up) on Port D ;Read Port D. Column code in lower nibble nop ;!!!! ;Store column code to r20 on lower nibble ;Set rows as inputs and columns as outputs on Port D ;Set rows to high (pull up) and columns to low on Port D ;Read Port D. Row code in higher nibble 11/12
12 nop ;!!!!! in r16, ;Store row code to r20 on higher nibble ;Set rows as inputs and columns as outputs ;Set rows to high and columns to low to activate JP13 Clear intf2 flag ldi r16, out gifr, r16 ;Restore registers from stack (in opposite order) pop pop ;Enable interrupts globally reti 12/12
AGH University of Science and Technology Cracow Department of Electronics
AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 25/05/16 1/11 1. Introduction
More informationCHAPTER 11 INTERRUPTS PROGRAMMING
CHAPTER 11 INTERRUPTS PROGRAMMING Interrupts vs. Polling An interrupt is an external or internal event that interrupts the microcontroller To inform it that a device needs its service A single microcontroller
More informationATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi
1 P a g e ATmega Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming in Assembly
More informationInterrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo
Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0
More informationCOMP2121: Microprocessors and Interfacing
Lecture 19: Interrupts II http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts
More informationInterrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1
Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR
More informationTopic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR
Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Objectives To become familiar with interrupts on the AVR Maskable and non-maskable Initialization Triggers To develop interrupt service routines
More informationEmbedded Systems and Software
Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032
More informationINTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab
INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.
More informatione-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text
e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text 1. Interrupt An interrupt is the occurrence of a condition--an event --
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Interrupts Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA March 1, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More information8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More information8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up
More informationModule 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function
Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32x8GeneralPurposeWorkingRegisters Up to 10
More informationFundamental concept in computation Interrupt execution of a program to handle an event
Interrupts Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues
More information8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up
More informationIntroduction to Embedded Systems
Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationSchool of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia
ECTE333 s schedule ECTE333 Lecture 9 -Timers School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia Week Lecture (2h) Tutorial (h) Lab (2h) L7: C programming
More informationAtmel AVR Timers and Interrupts
1 P a g e Atmel AVR Timers and Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming
More informationINTERRUPTS in microprocessor systems
INTERRUPTS in microprocessor systems Microcontroller Power Supply clock fx (Central Proccesor Unit) CPU Reset Hardware Interrupts system IRQ Internal address bus Internal data bus Internal control bus
More informationAVR Subroutine Basics
1 P a g e AVR Subroutine Basics READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 3: Branch, Call, and Time Delay
More information8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration
Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationAVR Microcontrollers Architecture
ก ก There are two fundamental architectures to access memory 1. Von Neumann Architecture 2. Harvard Architecture 2 1 Harvard Architecture The term originated from the Harvard Mark 1 relay-based computer,
More informationTimers and Interrupts. Mark Neil - Microprocessor Course
Timers and Interrupts 1 Example Product: Signal Generator A Signal Generator should be programmable. A user can use the the LCD display and the keyboard to change the: Frequency scale Amplitude scale Offset
More information8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 89 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to
More informationInterrupts and timers
Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable
More informatione-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text
e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text In this lecture embedded C program for interrupt handling
More informationCPEG300 Embedded System Design. Lecture 6 Interrupt System
CPEG300 Embedded System Design Lecture 6 Interrupt System Hamad Bin Khalifa University, Spring 2018 Correction Lecture 3, page 18: Only direct addressing mode is allowed for pushing or popping the stack:
More information8-bit Microcontroller with 1K Byte Flash. ATtiny15L
Features High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static
More information8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information
Features High-performance, Low-power AVR 8-bit Microcontroller 3 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 8 MIPS Throughput
More information8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.
Features High-performance and Low-power AVR 8-bit RISC Architecture 118 Powerful Instructions Most Single Cycle Execution 32 x 8 General Purpose Working Registers Up to 8 MIPS Throughput at 8 MHz Data
More informationChapter 09. Programming in Assembly
Chapter 09 Programming in Assembly Lesson 03 Programming Approach for Main and Interrupt Service Routines in 8051 Program Approach for programming Main Program Instructions 3 Main program initial instructions
More informationProcessor and compiler dependent
Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues What can
More information8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L
Features High-performance, Low-power AVR 8-bit Microcontroller 3 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 8 MIPS Throughput
More informationINTERRUPTS PROGRAMMING
INTERRUPTS PROGRAMMING The 8051 Microcontroller and Embedded Systems: Using Assembly and C Mazidi, Mazidi and McKinlay Chung-Ping Young 楊中平 Home Automation, Networking, and Entertainment Lab Dept. of Computer
More information8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.
AVR134: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time,
More informationThese three counters can be programmed for either binary or BCD count.
S5 KTU 1 PROGRAMMABLE TIMER 8254/8253 The Intel 8253 and 8254 are Programmable Interval Timers (PTIs) designed for microprocessors to perform timing and counting functions using three 16-bit registers.
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More informationMicroprocessors and Microcontrollers (EE-231)
Microprocessors and Microcontrollers (EE-231) Objective Interrupts Programming in C In Proteus On 8051 development board Interrupt An interrupt is an external or internal event that interrupts the microcontroller
More informationAVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE
AVR 8-bit Microcontrollers AVR134: Real Time Clock (RTC) Using the Asynchronous Timer APPLICATION NOTE Features Real Time Clock with Very Low Power Consumption (10µA @ 3.3V) Very Low Cost Solution Adjustable
More information8051 Microcontroller Interrupts
8051 Microcontroller Interrupts There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be
More informationAVR Timers TIMER0. Based on:
AVR Timers TIMER0 Based on: http://maxembedded.wordpress.com/2011/06/24/avr-timers-timer0-2/ The basic concepts of AVR Timers. Let me summarize it: We have seen how timers are made up of registers, whose
More informationCoE3DJ4 Digital Systems Design. Chapter 6: Interrupts
CoE3DJ4 Digital Systems Design Chapter 6: Interrupts Interrupts An interrupt is the occurrence of an event that causes a temporary suspension of a program while the condition is serviced by another program.
More informationGrundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss
Grundlagen Microcontroller Interrupts Günther Gridling Bettina Weiss 1 Interrupts Lecture Overview Definition Sources ISR Priorities & Nesting 2 Definition Interrupt: reaction to (asynchronous) external
More informationMechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD
Mechatronics and Microcomputers Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD ATmega128 CPU Single-level pipelining Egyciklusú ALU működés Reg. reg., reg. konst. közötti műveletek
More informationUniversity of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.
University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 03 Low Power Mode and Port Interrupts Goals: Bonus: Pre Lab Questions:
More information8-bit Microcontroller with 128K Bytes In-System Programmable Flash. ATmega103 ATmega103L
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 121 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers + Peripheral
More informationLab 9: On-Board Time Generation and Interrupts
Lab 9: On-Board Time Generation and Interrupts Summary: Develop a program and hardware interface that will utilize externally triggered interrupts and the onboard timer functions of the 68HC12. Learning
More informationPhysics 120B: Lecture 11. Timers and Scheduled Interrupts
Physics 120B: Lecture 11 Timers and Scheduled Interrupts Timer Basics The ATMega 328 has three @mers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, on Arduino TIMER0 is an 8- bit
More information8-bit Microcontroller with 64K/128K Bytes In-System Programmable Flash. ATmega603 ATmega603L ATmega103 ATmega103L. Preliminary.
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 120/121 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationAT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration
Features Utilizes the AVR Enhanced RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Downloadable Flash - SPI Serial Interface for Program
More informationInterrupts. EE4380 Fall 2001 Class 9. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas
8051 - Interrupts EE4380 Fall 2001 Class 9 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Polling Vs Interrupts Polling: MCU monitors all served devices continuously,
More information8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12
Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Up
More information8051 I/O and 8051 Interrupts
8051 I/O and 8051 Interrupts Class 7 EE4380 Fall 2002 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Agenda 8051 I/O Interfacing Scanned LED displays LCD displays
More informationAGH University of Science and Technology Cracow Department of Electronics
AGH University of Science and Technology Cracow Department of Electronics Microcontrollers Lab Tutorial 2 GPIO programming Author: Paweł Russek http://www.fpga.agh.edu.pl/upt2 ver. 26.10.16 1/12 1. Objectives
More informationNewbie s Guide to AVR Interrupts
Newbie s Guide to AVR Interrupts Dean Camera March 15, 2015 ********** Text Dean Camera, 2013. All rights reserved. This document may be freely distributed without payment to the author, provided that
More informationwww.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com Time : Three hours Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011 Sixth
More information8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to
More informationMicroprocessors B (17.384) Spring Lecture Outline
Microprocessors B (17.384) Spring 2013 Lecture Outline Class # 04 February 12, 2013 Dohn Bowden 1 Today s Lecture Administrative Microcontroller Hardware and/or Interface Programming/Software Lab Homework
More informationMarten van Dijk, Syed Kamran Haider
ECE3411 Fall 2015 Lecture 3b. Timers 0, 1 & 2 Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Based
More informationMICROPROCESSORS TECHNOLOGY II
AGH University of Science and Technology IEiT Department of Electronics MICROPROCESSORS TECHNOLOGY II Exceptions and Interrupts Paweł Russek http://www.fpga.agh.edu.pl/upt2 15 Nov 2016 1 INTRODUCTION 1.1
More information8051 Microcontroller
8051 Microcontroller The 8051, Motorola and PIC families are the 3 leading sellers in the microcontroller market. The 8051 microcontroller was originally developed by Intel in the late 1970 s. Today many
More informationAVR MICROCONTROLLER ARCHITECTURTE
AVR MICROCONTROLLER ARCHITECTURTE AVR MICROCONTROLLER AVR- Advanced Virtual RISC. The founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute
More informationPhysics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts
Physics 124: Lecture 12 Timers and Scheduled Interrupts Timer Basics The Arduino Uno/Nano (ATMega 328) has three Hmers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, (as assembled)
More informationModule 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1
Module 3 Embedded Systems I/O Version 2 EE IIT, Kharagpur 1 Lesson 15 Interrupts Version 2 EE IIT, Kharagpur 2 Instructional Objectives After going through this lesson the student would learn Interrupts
More informationEKT222 Miroprocessor Systems Lab 5
LAB 5: Interrupts Objectives: 1) Ability to define interrupt in 8085 microprocessor 2) Ability to understanding the interrupt structure in the 8085 microprocessor 3) Ability to create programs using the
More informationLaboratory 3 Working with the LCD shield and the interrupt system
Laboratory 3 Working with the LCD shield and the interrupt system 1. Working with the LCD shield The shields are PCBs (Printed Circuit Boards) that can be placed over the Arduino boards, extending their
More informationLab 4 Interrupts ReadMeFirst
Lab 4 Interrupts ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) Interrupt Vector Table 3) Pin out Summary Objectives Understand how interrupts work Learn to program Interrupt Service Routines in C Language
More informationAVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture
More information8051 Microcontroller
8051 Microcontroller 1 Salient Features (1). 8 bit microcontroller originally developed by Intel in 1980. (2). High-performance CMOS Technology. (3). Contains Total 40 pins. (4). Address bus is of 16 bit
More informationacret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.
acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.) Module 0 Introduction Introduction to Embedded Systems, Real Time
More informationVCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)
Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 120 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static
More informationLecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad
Lecture 14 AUTOMATIC CONTROL SYSTEMS Ali Karimpour Associate Professor Ferdowsi University of Mashhad Lecture 4 The AVR Microcontroller Introduction to AVR CISC (Complex Instruction Set Computer) Put as
More information12. Interrupts and Programmable Multilevel Interrupt Controller
12. Interrupts and Programmable Multilevel Interrupt Controller 12.1 Features Short and predictable interrupt response time Separate interrupt configuration and vector address for each interrupt Programmable
More informationBHARATHIDASAN ENGINEERING COLLEGE. III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013)
BHARATHIDASAN ENGINEERING COLLEGE III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013) FREQUENTLY ASKED QUESTIONS IN UNIVERSITY EXAMINATION PART A UNIT 1-8085 PROCESSOR 1. Draw the
More informationAVR ISA & AVR Programming (I)
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo Week 1 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation Week 1 2 1 Atmel AVR 8-bit
More informationAVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture
More informationToday's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2
Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2 Intro to programming in C time permitting Lab 1&2 Marking scheme: Announcements: Turn
More information8-Bit Microcontroller with 1K bytes In-System Programmable Flash AT90S1200. Features. Description. Pin Configuration
Features AVR - High Performance and Low Power RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Flash SPI Serial Interface for Program
More informationFIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)
(Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all
More informationTIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */
The codes below which help in better understanding of timers and counters. I have tested this code for atmega32. I have taken reference from www.avrfreaks.net. Hope you all will find this useful. Darsh
More informationChapter 6 Interrupts. (I. Scott Mackenzie) By: Masud-ul-Hasan
Chapter 6 Interrupts (I. Scott Mackenzie) 1 Interrupts An interrupt is the occurrence of an event that causes a temporary suspension of a program while the condition is serviced by another program. It
More informationC Language Programming, Interrupts and Timer Hardware
C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and
More informationMicrocontroller and Embedded Systems:
Microcontroller and Embedded Systems: Branches: 1. Electronics & Telecommunication Engineering 2. Electrical & Electronics Engineering Semester: 6 th Semester / 7 th Semester 1. Explain the differences
More informationMicrocontrollers. Program organization Interrupt driven I/O. EECE 218 Microcontrollers 1
EECE 218 Microcontrollers Program organization Interrupt driven I/O EECE 218 Microcontrollers 1 Software Architecture How to organize the code for a microcontoller application? Typical microcontroller
More informationATmega128. Introduction
ATmega128 Introduction AVR Microcontroller 8-bit microcontroller released in 1997 by Atmel which was founded in 1984. The AVR architecture was conceived by two students (Alf-Egil Bogen, Vergard-Wollen)
More informationMarten van Dijk Department of Electrical & Computer Engineering University of Connecticut
ECE3411 Fall 2016 Lecture 4b. Review Session Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Copied from Lecture 4b, ECE3411 Fall
More information8051 Interrupt Organization
Interrupt Interrupts of 8051 Introduction 8051 Interrupt organization Processing Interrupts Program Design Using Interrupts Timer Interrupts Serial Port Interrupts External Interrupts Interrupt Timings
More informationMaxim > Design Support > Technical Documents > Application Notes > Microcontrollers > APP 4465
Maxim > Design Support > Technical Documents > Application Notes > Microcontrollers > APP 4465 Keywords: MAXQ, MAXQ610, UART, USART, serial, serial port APPLICATION NOTE 4465 Using the Serial Port on the
More informationTimer Module Timer A. ReadMeFirst
Timer Module Timer A ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) TimerModule Lecture material 3) PinOutSummary 4) InterruptsVectorTable 5) Source code for screencast Interrupt Review Overview A Timer
More information[TUT] Newbie's Guide to AVR Interrupts
This tutorial is about interrupt driven USART receive and transmit routines written in AVR assembly. The hardware is: Arduino Mega2560 Adafruit Ultimate GPS IBM PC Atmel JTAGICE3 Software: Atmel AS6.1
More informationUnderstanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,
Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and
More informationSYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET
1 SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET Intel 8086/8088 Architecture Segmented Memory, Minimum and Maximum Modes of Operation, Timing Diagram, Addressing Modes, Instruction Set,
More informationInterrupts Peter Rounce - room 6.18
Interrupts Peter Rounce - room 6.18 P.Rounce@cs.ucl.ac.uk 20/11/2006 1001 Interrupts 1 INTERRUPTS An interrupt is a signal to the CPU from hardware external to the CPU that indicates than some event has
More informationQuestion Bank Microprocessor and Microcontroller
QUESTION BANK - 2 PART A 1. What is cycle stealing? (K1-CO3) During any given bus cycle, one of the system components connected to the system bus is given control of the bus. This component is said to
More information