Interrupts and timers

Size: px
Start display at page:

Download "Interrupts and timers"

Transcription

1 Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018

2 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable interrupts 2 Interrupts on AVR Interrupts in AVR-libc 3 Interrupt sources Timers and PWM 4 Concluding remarks 5 Concurrency, a brief overview

3 Overview Interrupts What is it? How are they programmed? Pitfalls? Specific peripherals in the AVR External interrupts Timer Read the data sheet Interrupts and timers 2/33

4 The interrupt mechanism A low-level mechanism for multitasking Interrupt what you are doing to handle an external signal. (Similar to the phone ringing) Vaguely similar to Java Threads or rather, threads can be implemented using interrupts the interrupt mechanism provides no scheduling, etc. interrupts do not provide separate stacks, etc. interrupts may have priorities (not on AVR) Interrupts Interrupts and timers 3/33

5 Types of interrupts Hardware interrupts externally generated frees CPU from polling Software interrupts generated by a CPU instruction On AVR: writing to a pin change interrupt pin configured as output triggers the interrupt used, for instance, to implement system calls (on machines with memory protection) Interrupts : Interrupt types Interrupts and timers 4/33

6 Execution of an interrupt When an (external) signal (IRQ) occurs, the normal execution of the CPU is interrupted: 1 An IRQ (for an enabled interrupt) occurs 2 The program counter (PC) value is pushed onto the stack 3 The CPU jumps to an interrupt handler (ISR) pointed to from the corresponding interrupt vector PC interrupt_table[irq_idx] 4 The ISR handles the interrupt 5 ISR returns to the interrupted routine reti(); ((Possibly) clear interupt flag, then PC pop()) not all interrupt flags are cleared by hardware. If not, the ISR must clear the interrupt flag. Interrupts : Execution of an interrupt Interrupts and timers 5/33

7 Typical interrupt vector table on ATMega88 0 x000 rjmp RESET ; Reset Handler 0 x001 rjmp EXT_INT0 ; IRQ0 Handler 0 x002 rjmp EXT_INT1 ; IRQ1 Handler 0 x003 rjmp PCINT0 ; PCINT0 Handler 0 x004 rjmp PCINT1 ; PCINT1 Handler 0 x005 rjmp PCINT2 ; PCINT2 Handler 0 x006 rjmp WDT ; Watchdog Timer Handler 0 x007 rjmp TIM2_COMPA ; Timer2 Compare A Handler 0 X008 rjmp TIM2_COMPB ; Timer2 Compare B Handler 0 x009 rjmp TIM2_OVF ; Timer2 Overflow Handler 0 x00a rjmp TIM1_CAPT ; Timer1 Capture Handler (---) 0 x01a RESET : ldi r16, high ( RAMEND ); Main program start 0 x01b out SPH, r16 ; Set Stack Pointer to top of RAM 0 x01c ldi r16, low ( RAMEND ) 0 x01d out SPL, r16 0 x01e sei ; Enable interrupts 0 x01f <instr > xxx Interrupts : Execution of an interrupt Interrupts and timers 6/33

8 Maskable interrupts ATmega48/88/ ICR1H and ICR1L Input capture register 1 Bit (0x87) ICR1[15:8] ICR1H An interrupt mask selects which interrupts are enabled (0x86) ICR1[7:0] ICR1L Read/write R/W R/W R/W R/W R/W R/W R/W R/W ATmega48/88/168 Initial value AVR Example: Timer/Counter interrupt mask (TIMSKn). The Input Capture is updated with the counter (TCNT1) value each time an event occurs on the Similar for ICP1 other pin (or optionally peripherals on the Analog Comparator output for Timer/Counter1). The Input Capture TIMSK0 Timer/counter can be used interrupt for defining mask the register counter TOP value. The Bit Input Capture 7 Register 6 is 16-bit 5in size. To 4 ensure 3 that both 2 the high 1 and low 0bytes are read (0x6E) OCIE0B OCIE0A TOIE0 TIMSK0 simultaneously when the CPU accesses these registers, the access is performed using an 8-bit Read/write R R R R R R/W R/W R/W temporary High Byte Register (TEMP). This temporary register is shared by all the other 16-bit Initial value registers. See Accessing 16-bit registers on page 110. Bits 7..3 Res: Reserved bits TIMSK1 Timer/Counter1 interrupt mask register These bits are reserved bits in the Atmel ATmega48/88/168 and will always read as zero. Bit (0x6F) ICIE1 OCIE1B OCIE1A TOIE1 Bit 2 OCIE0B: Timer/counter output compare match B interrupt enable TIMSK1 Read/write R R R/W R R R/W R/W R/W When the OCIE0B bit is written to one, and the I-bit in the Status Register is set, the Initial value Timer/Counter Compare Match B interrupt is enabled. The corresponding interrupt is executed if a Compare Bit 7, 6 Res: Match Reserved in Timer/Counter bits occurs, that is, when the OCF0B bit is set in the Timer/Counter These bits are unused Interrupt bits Flag in Register the Atmel ATmega48/88/168, TIFR0. and will always read as zero. Some interrupts are non-maskable (e.g., reset) Bit 15 OCIE0A: ICIE1: Timer/Counter1, Timer/Counter0 input output capture compare interrupt match enable A interrupt enable When this the bit OCIE0A is written bit to is one, written and to the one, I-flag and in the Status I-bit in Register the Status is set Register (interrupts is set, globally the Timer/Counter0 enabled), the Timer/Counter1 Compare Match Input A interrupt Capture is interrupt enabled. is The enabled. corresponding The corresponding interrupt is executed Interrupt if Vector a Compare (see Interrupts Match in on Timer/Counter0 page 56) is executed occurs, when that the is, ICF1 when Flag, the located OCF0A in bit TIFR1, is set is in set. the Timer/Counter 0 Interrupt Flag Register TIFR0. Bit 4, 3 Res: Reserved bits These Bit 0 bits TOIE0: are unused Timer/Counter0 bits in the ATmega48/88/168, overflow interrupt and enable will always read as zero. Interrupts : Maskable interrupts When the TOIE0 bit is written to one, and the I-bit in Interrupts the Status and Register timers is set, the 7/33

9 The global interrupt flag Sometimes, you do not want to be interrupted, for performance or data consistency reasons CLear Interrupts: turn off all interrupts CLI / cli(); SEt Interrupts: turn on all interrupts SEI / sei(); Enabling an interrupt requires both enabling it in the corresponding interrupt mask, and setting the global interrupt enabled flag Interrupts : Maskable interrupts Interrupts and timers 8/33

10 Saving and restoring the interrupt flag A more reusable and robust way On the AVR, the interrupt flag is in the status register # include <avr / interrupt.h> void do_something_atomic () { unsigned char sreg = SREG ;// remember status register cli (); // disable interrupts do_stuff (); // without being interrupted SREG = sreg ; // restore status register } take care if you rely on other flags in SREG See also ATOMIC_BLOCK in util/atomic.h Interrupts : Maskable interrupts Interrupts and timers 9/33

11 Handling interrupts in AVR-libc Interrupt names defined in header files (e.g., avr/iomx8.h) Refer to the documentation (avr-libc documentation link in the help menu of AVRstudio.) Example ISR for overflow in Timer 0 # include <avr / io.h> # include <avr / interrupt.h> ISR ( TIMER0_OVF_vect, ISR_NAKED ) { // do something each time timer0 overflows reti (); } Interrupts on AVR : Interrupts in AVR-libc Interrupts and timers 10/33

12 Handling interrupts (cont d) The ISR macro takes attributes to specify its behaviour ISR_BLOCK: run with interrupts disabled ISR_NONBLOCK: do not disable interrupts Nesting interrupts needs more careful analysis Avoid if not necessary ISR ( some_vect, ISR_BLOCK ) { // do something // NB! no reti () as that is done in the // epilogue inserted by the macro } Interrupts on AVR : Interrupts in AVR-libc Interrupts and timers 11/33

13 External interrupts The AVR has two kinds of external interrupts: PCINT: pin change interrupt generates an interrupt when a pin changes value available on all pins three sets of pins (controlled by PCICR) several pins can trigger the same interrupt may be handy for the two encoder signals INT0, INT1 more configurable: pin change, edge, or level triggered controlled by EICRA (PCINT14/RESET) PC6 (PCINT16/RXD) PD0 (PCINT17/TXD) PD1 (PCINT18/INT0) PD2 (PCINT19/OC2B/INT1) PD3 (PCINT20/XCK/T0) PD4 Interrupt sources Interrupts and timers 12/

14 Example, PCINT for pin 24 Consult data sheet pin 24 PCINT9 PCICR: PCINT14..8 PCIE1 Find the bit in PCMSK1 volatile int counter; ISR(PCINT1_vect) { // count positive edges if(pinc & (1<<PINC1)) counter++; } void setup_interrupt(){ PCICR = (1<<PCIE1); PCMSK1 = (1<<PCINT9); sei(); } Interrupt sources Interrupts and timers 13/33

15 Timers A counter, clocked from the system clock or externally Can output a waveform on its output pin(s) Prescaler for the system clock (clk/8, clk/64,..., clk/1024) Can give two (three) types of interrupts overflow when the counter wraps output compare when the counter reaches a set value more programmable, two compare values also used for waveform generation (input capture) saves the timer value when an external event occurs useful for accurately timestamping events only in timer 1 on the ATMega88 Interrupt sources : Timers and PWM Interrupts and timers 14/33

16 Prescaling Clocked by clk IO clk I/O clk Tn (clk I/O /1) TCNTn MAX - 1 MAX BOTTOM BOTTOM + 1 TOVn Clocked by clk IO /8 clk_i/o clk I/O clk Tn (clk I/O /8) TCNTn MAX - 1 MAX BOTTOM BOTTOM + 1 TOVn Interrupt sources : Timers and PWM Interrupts and timers 15/33

17 Timer usage Required configuration set prescaler for desired frequency range set mode of operation if needed, enable interrupts if needed, setup output pins (DDRx and TCCRnA) PWM mode(s) for waveform generation, it is usually best to use the built-in PWM modes if possible. (typically fast PWM) CTC mode Clear Timer on Compare match allows more fine-grained control over interrupt frequency Interrupt sources : Timers and PWM Interrupts and timers 16/33

18 Fast PWM mode Single slope counting OCRnx controls duty cycle OCRnx is double buffered in the PWM modes OCRnx interrupt flag set OCRnx update and TOVn interrupt flag set TCNTn OCn (COMnx1:0 = 2) OCn (COMnx1:0 = 3) Period Interrupt sources : Timers and PWM Interrupts and timers 17/33

19 Fast PWM: Setting period time TOP can be fixed, or set using OCRnA or ICR1 OCRnx/BOTTOM update and TOVn interrupt flag set and OCnA interrupt flag set or ICFn interrupt flag set (interrupt on TOP) TCNTn OCnx OCnx (COMnx1:0 = 2) (COMnx1:0 = 3) Period Interrupt sources : Timers and PWM Interrupts and timers 18/33

20 Count Clear Direction Control logic clk Tn TOVn (Int.req.) Clock select Edge detector Tn TOP BOTTOM Timer/counter TCNTn = = 0 (From prescaler) OCnA (Int.req.) = Waveform generation OCnA DATA BUS OCRnA = OCRnB Fixed TOP value OCnB (Int.req.) Waveform generation OCnB TCCRnA TCCRnB Interrupt sources : Timers and PWM Interrupts and timers 19/33

21 Tips Avoid using many interrupts concurrently prototype by polling, then switch to ISR if necessary Usually a good idea to disable interrupts while executing ISRs (e.g., ISR_BLOCK to avoid data races to avoid running out of stack space Try to keep ISRs very short if possible, only store data and/or set a flag and do the actual processing elsewhere Shared data must be global and volatile Concluding remarks Interrupts and timers 20/33

22 Tips... (cont d) Check (in data sheet) if interrupt flags are reset by the hardware or if you need to do it in code if not reset, nonblocking ISRs will get called over and over UART interrupts level triggered external interrupts Concluding remarks Interrupts and timers 21/33

23 Summary, interrupts We have introduced The interrupt mechanism Types Execution Interrupts on the AVR interrupt functionality in avr-libc external interrupts timers, PWM and... do read the data sheet Concluding remarks Interrupts and timers 22/33

24 Concurrency Functions executing (logically) in parallel time sharing Independent routines (preemptive multi-tasking) Interrupting, or preempting, each other Example: two independent controllers Cooperative multi-tasking Triggering, or yielding to, each other Example: a controller and its operator communication On a single CPU routines interrupting (preempting) each other On multiprocessor machines true parallelism Concurrency, a brief overview Interrupts and timers 23/33

25 In small embedded systems Typically No operating system No threads or concurrency primitives A single program A main loop One or a few interrupt routines Potential problems Data consistency (data races) Deadlock Concurrency, a brief overview Interrupts and timers 24/33

26 Race conditions Concurrent acces of a shared resource by multiple routines Even if all routines are correct, the result may sometimes be correct and sometimes wrong The result depends on the order of execution ( interleaving ) of the individual machine instructions Shared resources Variables (i.e., memory locations) Registers Peripherals Concurrency, a brief overview Interrupts and timers 25/33

27 Race conditions (cont d) Example: bank account void deposit ( int acctnbr, int amount ) { int bal = getbalance ( acctnbr ); [ d1] bal = bal + amount ; [ d2] setbalance ( acctnbr, bal ); [ d3] } void withdraw ( int acctnbr, int amount ) { int bal = getbalance ( acctnbr ); [ w1] bal = bal - amount ; [ w2] setbalance ( acctnbr, bal ); [ w3] } Concurrency, a brief overview Interrupts and timers 26/33

28 Example (cont d) Starting balance: 1000 Concurrently Salary is paid: deposit You withdraw 500 What happens if the routines can interrupt each other at any instant? Concurrency, a brief overview Interrupts and timers 27/33

29 Correct executions d1: bal == 1000 w1: bal == 1000 d2: bal == w2: bal == 500 d3: setbalance(bal) w3: setbalance(bal) w1: bal == d1: bal == 500 w2: bal == d2: bal == w3: setbalance(bal) d3: setbalance(bal) * balance is * balance is Concurrency, a brief overview Interrupts and timers 28/33

30 Wrong executions (examples) d1: bal == 1000 w1: bal == 1000 w1: bal == 1000 w2: bal == 500 w2: bal == 500 d1: bal == 1000 w3: setbalance(bal) d2: bal == d2: bal == d3: setbalance(bal) d3: setbalance(bal) w3: setbalance(bal) * balance is * balance is 500 Concurrency, a brief overview Interrupts and timers 29/33

31 The problem Class of operations: read-modify-write needs to be atomic the real value must be consistent with temporary values (local variables) used during the modification Typical scenario Check a condition Act on it, possibly affecting system state Examples Check if data is available in buffer, then read Check that a peripheral is free, then use it Read/write a set of variables that must be consistent Concurrency, a brief overview Interrupts and timers 30/33

32 The solution Critical sections atomic pieces of code that may not (cannot) be interrupted by other routines At the low level turning off interrupts At the higher level semaphores, monitors studied in real-time programming courses Concurrency, a brief overview Interrupts and timers 31/33

33 Deadlock (sketched version) Waiting in a critical section for a condition caused by code in another critical section May lead to circular waiting waiting in a critical section makes it impossible to enter another critical section i.e., the program hangs Avoid waiting in critical sections in particular, interrupt service routines More on the topic, and its analysis, in the real-time programming courses Concurrency, a brief overview Interrupts and timers 32/33

34 Summary, concurrency Be aware of concurrency Keep programs simple Turn off interrupts in interrupt service routines in critical sections of the main loop but not when waiting for an interrupt, of course Avoid waiting in interrupt routines Risk of deadlock Risk of missing other interrupts (i.e., keep ISRs short) Concurrency, a brief overview Interrupts and timers 33/33

EE 308: Microcontrollers

EE 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 information

COMP2121: Microprocessors and Interfacing

COMP2121: 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 information

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control Distributed Real-Time Control Systems Chapter 10 Real-Time Digital Control 1 Real-Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronized

More information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (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 information

Microprocessors & Interfacing

Microprocessors & 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 information

EE 308: Microcontrollers

EE 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 information

Embedded Systems and Software

Embedded 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 information

Timers and Interrupts. Mark Neil - Microprocessor Course

Timers 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 information

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control Distributed Real- Time Control Systems Lecture 7 Real- Time Control 1 Real- Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronizeda/d-

More information

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi

ATmega 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 information

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

8-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 information

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

8-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 information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-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 information

INTERRUPTS in microprocessor systems

INTERRUPTS 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 information

Microprocessors & Interfacing

Microprocessors & 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 information

Atmel AVR Timers and Interrupts

Atmel 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 information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (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 information

Newbie s Guide to AVR Interrupts

Newbie 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 information

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt? Interrupts Arduino, AVR, and deep dark programming secrets What is an Interrupt? A transfer of program control that is not directed by the programmer Like a phone call in the middle of a conversation Stop

More information

AGH University of Science and Technology Cracow Department of Electronics

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. 01/07/14 1/12 1. Introduction

More information

Unit 14 Timers and Counters 14.1

Unit 14 Timers and Counters 14.1 Unit 14 Timers and Counters 14.1 14.2 Counter/Timers Overview ATmega328P has two and one counters. Can configure to count at some frequency up to some value (a.k.a. ), generate an and counkng again, if

More information

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.

More information

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary

8-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 information

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */

TIMSK=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 information

Physics 120B: Lecture 11. Timers and Scheduled Interrupts

Physics 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 information

Fundamental concept in computation Interrupt execution of a program to handle an event

Fundamental 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 information

COMP 7860 Embedded Real- Time Systems: Threads

COMP 7860 Embedded Real- Time Systems: Threads COMP 7860 Embedded Real- Time Systems: Threads Jacky Baltes Autonomous Agents Lab University of Manitoba Winnipeg, Canada R3T 2N2 Email: jacky@cs.umanitoba.ca WWW: http://www.cs.umanitoba.ca/~jacky http://aalab.cs.umanitoba.ca

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz III

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz III Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz III There are 5 questions in this quiz. There are 11 pages in this quiz

More information

Embedded programming, AVR intro

Embedded programming, AVR intro Applied mechatronics, Lab project Embedded programming, AVR intro Sven Gestegård Robertz Department of Computer Science, Lund University 2017 Outline 1 Low-level programming Bitwise operators Masking and

More information

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts

Physics 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 information

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia

School 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 information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description

8-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 information

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.

8-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 information

AGH University of Science and Technology Cracow Department of Electronics

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 information

UNIVERSITY OF MANITOBA Final Exam

UNIVERSITY OF MANITOBA Final Exam UNIVERSITY OF MANITOBA Final Exam Winter 2007 COMPUTER SCIENCE Real-time Systems Date: Fri, 20th April 2007 Time: 09:00-12:00 Room: Frank Kennedy Brown Gym (314-345) (Time allowed: 180 Minutes) NOTE: Attempt

More information

Introduction to Embedded Systems

Introduction 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 information

8-bit Microcontroller with 128K Bytes In-System Programmable Flash. ATmega103 ATmega103L

8-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 information

8-bit Microcontroller with 1K Byte Flash. ATtiny15L

8-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 information

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

8-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 information

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Introduction Timer s objective Timer features Timer Registers - Understand function of each bit Initialization Introduction o In micro-p, we use counter

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.

8-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 information

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration

8-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 information

8-bit Microcontroller with 64K/128K Bytes In-System Programmable Flash. ATmega603 ATmega603L ATmega103 ATmega103L. Preliminary.

8-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 information

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 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 information

AVR Subroutine Basics

AVR 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 information

AVR Timers TIMER0. Based on:

AVR 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 information

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Grundlagen 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 information

Marten van Dijk, Syed Kamran Haider

Marten 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 information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information

8-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 information

8-bit Microcontroller with 4/8K Bytes In-System Programmable Flash. ATtiny48/88. Preliminary

8-bit Microcontroller with 4/8K Bytes In-System Programmable Flash. ATtiny48/88. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 23 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)

VCC 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 information

AVR Microcontrollers Architecture

AVR 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 information

Design and Implementation Interrupt Mechanism

Design and Implementation Interrupt Mechanism Design and Implementation Interrupt Mechanism 1 Module Overview Study processor interruption; Design and implement of an interrupt mechanism which responds to interrupts from timer and UART; Program interrupt

More information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L

8-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 information

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 54 Powerful Instructions Most Single Clock Cycle Execution 16 x 8 General Purpose Working Registers Fully Static

More information

EE4390 Microprocessors

EE4390 Microprocessors EE4390 Microprocessors Lessons 23, 24 - Exceptions - Resets and Interrupts Revised: Aug 1, 2003 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions

More information

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V

8-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 information

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function

Module 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 information

Context Switching & Task Scheduling

Context Switching & Task Scheduling ECE3411 Fall 2015 Lab 6b. Context Switching & Task Scheduling Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu

More information

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary This document contains complete and detailed description of all modules included in the AVR XMEGA TM D Microcontroller family. The XMEGA D is a family of low power, high performance and peripheral rich

More information

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut

Marten 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 information

Processor and compiler dependent

Processor 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 information

Interrupts and Serial Communication on the PIC18F8520

Interrupts and Serial Communication on the PIC18F8520 Interrupts and Serial Communication on the PIC18F8520 Kyle Persohn COEN 4720 Fall 2011 Marquette University 6 October 2011 Outline 1 Background Serial Communication PIC18 Interrupt System 2 Customizing

More information

Computer Labs: I/O and Interrupts

Computer Labs: I/O and Interrupts Computer Labs: I/O and Interrupts 2 o MIEIC Pedro F. Souto (pfs@fe.up.pt) October 3, 2010 I/O Operation I/O devices are the interface between the computer and its environment Most of the time, the processor

More information

CprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing. Instructors: Dr. Phillip Jones Dr.

CprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing. Instructors: Dr. Phillip Jones Dr. CprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing Instructors: Dr. Phillip Jones Dr. Zhao Zhang 1 Announcements Final Projects Projects: Mandatory Demos Deadweek

More information

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE 8-bit AVR Microcontroller ATmega8A DATASHEET COMPLETE Introduction The Atmel ATmega8A is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions

More information

Synchronization I. Jo, Heeseung

Synchronization I. Jo, Heeseung Synchronization I Jo, Heeseung Today's Topics Synchronization problem Locks 2 Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Also, to coordinate

More information

timer 1 Fri Oct 13 13:00:

timer 1 Fri Oct 13 13:00: timer 1 Fri Oct 1 1:00: 1.1 Introduction SECTION CAPTURE/COMPARE TIMER This section describes the operation of the 1-bit capture/compare timer. Figure -1 shows the structure of the timer module. Figure

More information

Newbie s Guide to AVR Timers

Newbie s Guide to AVR Timers Newbie s Guide to AVR Timers Dean Camera November 5, 204 ********** Text Dean Camera, 203. All rights reserved. This document may be freely distributed without payment to the author, provided that it is

More information

Lab 9: On-Board Time Generation and Interrupts

Lab 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 information

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX. Yousef Ebrahimi Professor Ryan Robucci

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX.   Yousef Ebrahimi Professor Ryan Robucci AvrX https://github.com/kororos/avrx Yousef Ebrahimi Professor Ryan Robucci Introduction AvrX is a Real Time Multitasking Kernel written for the Atmel AVR series of micro controllers. The Kernel is written

More information

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts EE4800-03 Embedded Systems Design Lessons 7-10 - Exceptions - Resets and Interrupts 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions Resets

More information

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?)

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?) 1 Process Context 1.1 What is context? A process is sometimes called a task, subroutine or program. Process context is all the information that the process needs to keep track of its state. Registers Temporary

More information

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12

8-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 information

12.1. Unit 12. Exceptions & Interrupts

12.1. Unit 12. Exceptions & Interrupts 12.1 Unit 12 Exceptions & Interrupts 12.2 Disclaimer 1 This is just an introduction to the topic of interrupts. You are not meant to master these right now but just start to use them We will cover more

More information

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34 A Brief Overview Christopher Kenna Avionics October 1, 2010 1 / 34 Introduction Outline 1 Introduction About Kernel Overview 2 Tasks Tasks versus Co-Routines Task Details 3 IPC and Synchronization Queues

More information

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2 CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2 Thursday, April 12, 2012 Instructions: You will have the full class period to complete this test. Make sure to show your work to ensure you receive partial

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (Sept. 30, 2013) 1/15 538 Lecture Notes Week 5 Answers to last week's questions 1. With the diagram shown for a port (single bit), what happens if the Direction Register is read?

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs) ECE3411 Fall 2015 Lecture 2c. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk,

More information

UBC104 Embedded Systems. Review: Introduction to Microcontrollers

UBC104 Embedded Systems. Review: Introduction to Microcontrollers UBC104 Embedded Systems Review: Introduction to Microcontrollers Processors General purpose processors: 80386 Pentium Core Duo Large number of pins External memory External peripherals * Figure from Intel

More information

Corso di Elettronica dei Sistemi Programmabili

Corso di Elettronica dei Sistemi Programmabili Corso di Elettronica dei Sistemi Programmabili Sistemi Operativi Real Time freertos implementation Aprile 2014 Stefano Salvatori 1/24 Sommario RTOS tick Execution context Context switch example 2/24 RTOS

More information

Laboratory 4 Usage of timers

Laboratory 4 Usage of timers Laboratory 4 Usage of timers 1. Timer based interrupts Beside external interrupt, the MCU responds to internal ones which are triggered by external events (on the external pins). The source of the internal

More information

Use a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time.

Use a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time. Goal: In this project you will create an OS-driven multitasking device than can capture data at precise intervals, buffer the data to EEPROM, and send data over a serial interface to a computer, while

More information

System Programming. Prof. Dr. Antônio Augusto Fröhlich. Nov 2006

System Programming. Prof. Dr. Antônio Augusto Fröhlich.   Nov 2006 SysProg Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 88 System Programming Prof. Dr. Antônio Augusto Fröhlich guto@lisha.ufsc.br http://www.lisha.ufsc.br/~guto Nov 2006 SysProg Antônio Augusto Fröhlich

More information

Interrupts and Low Power Features

Interrupts and Low Power Features ARM University Program 1 Copyright ARM Ltd 2013 Interrupts and Low Power Features Module Syllabus Interrupts What are interrupts? Why use interrupts? Interrupts Entering an Exception Handler Exiting an

More information

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

Module 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 information

12. Interrupts and Programmable Multilevel Interrupt Controller

12. 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 information

Mark Redekopp, All rights reserved. EE 357 Unit 10b. Interrupts Timers

Mark Redekopp, All rights reserved. EE 357 Unit 10b. Interrupts Timers EE 357 Unit 10b Interrupts Timers IPL bits Coldfire / M68K Interrupts Coldfire interrupt architecture is based on original M68K 3-bit input (IPL[2:0]) indicating interrupt requests/priorities 000 = No

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh Computer Science Department

More information

MICROPROCESSOR BASED SYSTEM DESIGN

MICROPROCESSOR BASED SYSTEM DESIGN MICROPROCESSOR BASED SYSTEM DESIGN Lecture 5 Xmega 128 B1: Architecture MUHAMMAD AMIR YOUSAF VON NEUMAN ARCHITECTURE CPU Memory Execution unit ALU Registers Both data and instructions at the same system

More information

8-bit Atmel XMEGA D Microcontroller XMEGA D MANUAL

8-bit Atmel XMEGA D Microcontroller XMEGA D MANUAL This document contains complete and detailed description of all modules included in the Atmel AVR XMEGA D microcontroller family. The Atmel AVR XMEGA D is a family of low-power, high-performance, and peripheral-rich

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts

More information

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes Course Introduction Purpose: This course provides an overview of the Direct Memory Access Controller and the Interrupt Controller on the SH-2 and SH-2A families of 32-bit RISC microcontrollers, which are

More information

Chapter 9 Interrupt Controller

Chapter 9 Interrupt Controller Chapter 9 Interrupt Controller This chapter describes the operation of the interrupt controller portion of the system integration module (SIM). It includes descriptions of the registers in the interrupt

More information

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts Content Interrupts and Time Real-Time Systems, Lecture 5 [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts Martina Maggio 25 January 2017 Lund University, Department of Automatic

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Introduction to Embedded Systems Edward A. Lee UC Berkeley EECS 149/249A Fall 2016 2008-2016: E. A. Lee, A. L. Sangiovanni-Vincentelli, S. A. Seshia. All rights reserved. Chapter 10: Input and Output,

More information