Revised: Aug 1, 20141 ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.

Slides:



Advertisements
Similar presentations
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Advertisements

I/O Unit.
10-1 EE 319K Introduction to Microcontrollers Lecture 10: Interrupts, Output Compare Periodic Interrupts Read Book Sections 9.1, 9.2, 9.4, 9.6.1, 9.6.2,
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
EET 2261 Unit 10 Enhanced Capture Timer  Read Almy, Chapter 20.  Homework #10 and Lab #10 due next week.  Quiz next week.
68HC11 Polling and Interrupts
Introduction to Interrupts
EET 2261 Unit 9 Interrupts  Read Almy, Chapters 17 – 19.  Homework #9 and Lab #9 due next week.  Quiz next week.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
Exception Processing ECE511: Digital System & Microprocessor.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
1 Reset and Interrupts Advanced Programming. 2 Resets and Interrupts See the Reset and Interrupts Section in the 68HC11E Family Technical Data Sheet (pp.79-96)
The 8051 Microcontroller and Embedded Systems
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
Ch. 9 Interrupt Programming and Real-Time Sysstems From Valvano’s Introduction to Embedded Systems.
Revised: Aug 1, ECE 263 Embedded System Design Lesson 1 68HC12 Overview.
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
V 0.91 Polled IO versus Interrupt Driven IO Polled Input/Output (IO) – processor continually checks IO device to see if it is ready for data transfer –Inefficient,
Week #5 General Interfacing Techniques
Chapter 6: Interrupts and Resets
M Semiconductor Products Sector Computer Operating Properly Module Detail Slide #1 of 7 Tutorial Introduction PURPOSE -To explain how to configure and.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
Nurudeen Olayiwola Thomas Gutierrez
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
ME 4447/6405 Interrupts and Resets Suzanne Price Scott Gilliliand Greg Graf.
Interrupts and reset operations. Overview  Introduction to interrupts – What are they – How are they used  68HC11 interrupt mechanisms – Types of interrupts.
Microprocessors 1 MCS-51 Interrupts.
Revised: Aug 1, ECE263 Embedded System Design Lesson 4 Programming Model, Assembly Language, Instruction Execution Cycle.
Timer Timer is a device, which counts the input at regular interval (δT) using clock pulses at its input. The counts increment on each pulse and store.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
Appendix B: System Development Example MTT48 V2.1 B - 1 APPENDIX B: SYSTEM DEVELOPMENT.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
System Integration Module MTT Motoola SYSTEM INTEGRATION MODULE (SIM)
Chapter 5 - Interrupts.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
MICRO-CONTROLLER MOTOROLA HCS12 Interrupts Mechatronics Department Faculty of Engineering Ain Shams University.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
EET 2261 Unit 13 Enhanced Capture Timer
Lecture 8: TI MSP430 Interrupts, ISRs
HCS12 Exceptions Maskable Interrupts
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
ECE 3430 – Intro to Microcomputer Systems
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
Timer and Interrupts.
UNIT – Microcontroller.
11.1 Interrupt Mechanism, Type, and Priority
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
MCO556 Timer System Exercise.
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts

Revised: Aug 1, Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions –Resets –Interrupts: Maskable and Non-maskable 68HC12 Interrupt Response Exception Vector Exception Priority Programming an Interrupt Service Routine

Revised: Aug 1, Exceptions - Resets and Interrupts Polling versus interrupts –polling: constantly monitoring for flag to set program is tied up waiting for flag inefficient use of processor –interrupt: processor tells program when event has occurred program can be executing other tasks efficient use of processor –EX] sequentially ask question vs you ask me

Revised: Aug 1, Exceptions - Resets and Interrupts Resets: returns 68HC12 to known, well-defined state after detected fault –power-on reset –Computer Operating Properly (COP) reset –Clock Monitor reset –External reset Interrupts - planned, but unscheduled high priority event –non-maskable: may not be turned off by user –maskable: turned on and off by user with “I” bit in CCR

Revised: Aug 1, Exceptions - Resets and Interrupts “I” bit controlled with CLI and SEI command –CLI: Clear Interrupt Mask - turns interrupt system on –SEI: Set Interrupt Mask - turns interrupt system off Need to turn on specific interrupt locally

Revised: Aug 1, Exceptions - Resets and Interrupts (cont)

Revised: Aug 1, HC12 Interrupt Response fetch decode execute interrupt service routine

Revised: Aug 1, HC12 Interrupt Response Interrupt Vector –location of ISR –located in upper 128 bytes of memory –user must tie Vector to ISR Interrupt Priority –determines order of execution when multiple interrupts occur Interrupt Service Routine (ISR) - user written response routine to interrupt event

Revised: Aug 1, HC12 Interrupt Response - Interrupt Priority - "Copyright of Motorola, Used by Permission" Highest Priority Lowest Priority Non-maskable Maskable

Revised: Aug 1, Programming an Interrupt Service Routine Determine how interrupt is enabled –global: CLI –local enable bit Initialize Vector Table –directive approach –EVB SetUserVector Initialize Stack Enable interrupt Write the specific ISR

Revised: Aug 1, Programming an Interrupt Service Routine - an example Initialize the microprocessor for the interrupt. Initialize the stack - this is done through compiler settings Initialize any other necessary systems on the HC12. Initialize the interrupt vector table. You will need to use a special header file and code. –Header file is on your computer and is called abbie.h (change name). Code to set up your function to be an interrupt service routine will be similar to the following: This part declares your function as an interrupt service routine. #pragma interrupt_handler toggle_isr

Revised: Aug 1, Programming an Interrupt Service Routine - an example This part fills the appropriate vector with the address of your interrupt service routine. #pragma abs_address: 0x0B2A void (*Timer_Channel_2_interrupt_vector[])()={toggle_isr}; #pragma end_abs_address Make sure the interrupt you will be using is cleared to start. Initialize local interrupts. Initialize the interrupt system using the CLI command (With this header file use CLI(); ). Do this step last so that you aren’t inadvertently setting off interrupts before you finish initializing the system. Write the interrupt service routine to handle the interrupt.

Revised: Aug 1, Programming an ISR - an example Table 1. RAM Interrupt Vectors Interrupt Name RAM Vector Location BDLC (Key Wakeup J) $0B10, $0B11 ATD $0B12, $0B13 SCI $0B16, $0B17 SPI $0B18, $0B19 Pulse Accumulator Input Edge$0B1A, $0B1B Pulse Accumulator Overflow$0B1C, $0B1D Timer Overflow $0B1E, $0B1F Timer Channel 7 $0B20, $0B21 Timer Channel 6 $0B22, $0B23 Timer Channel 5 $0B24, $0B25 Timer Channel 4 $0B26, $0B27 Timer Channel 3 $0B28, $0B29 Timer Channel 2 $0B2A, $0B2B Timer Channel 1 $0B2C, $0B2D Timer Channel 0 $0B2E, $0B2F Real Time Interrupt $0B30, $0B31 IRQ $0B32, $0B33 XIRQ $0B34, $0B35 SWI $0B36, $0B37 Unimplemented Instruction Trap$0B38, $0B39 COP Failure $0B3A, $0B3B COP Clock Monitor Fail Reset$0B3C, $0B3D Reset $0BEF, $0BFF

Revised: Aug 1, Programming an Interrupt Service Routine - an example Example] In this task you will need to simultaneously generate two square waves with different frequencies. For one wave use the month and day of your birthday and for the second use the month and day of your Lab TA’s birthday. Verify that the waves are being generated simultaneously and that they have different frequencies with the oscilloscope.

Revised: Aug 1, Programming an Interrupt Service Routine - an example #include void toggle1_isr(void); //function prototype void toggle2_isr(void); #pragma interrupt_handler toggle1_isr //define as interrupt #pragma interrupt_handler toggle2_isr #pragma abs_address: 0x0B28 void (*Timer_Channel_3_interrupt_vector[])()={toggle2_isr}; void (*Timer_Channel_2_interrupt_vector[])()={toggle1_isr}; #pragma end_abs_address

Revised: Aug 1, Programming an Interrupt Service Routine - an example void initialize(void);// Define function initialize void main(void){ initialize(); // Initialize the timer system TMSK1 = 0x0C; TFLG1 = 0xFF; CLI(); // Initialize interrupts while(1) // Continuous loop { // Wait for interrupts ; }

Revised: Aug 1, Programming an Interrupt Service Routine - an example /* Function: initialize: enables the timer and sets up the M- Clk */ void initialize(){ CLKCTL = 0x02; // Set M-clock to divide by 4 (2 MHz) // CPU master clock divider ($0047) TMSK2 = 0x00; // Disable TOI, Prescale = 0; TIOS = 0x0C; // Make OS2 output compare TSCR = 0x80; // Enable the timer TCTL2 =0x50; }

Revised: Aug 1, Programming an Interrupt Service Routine - an example void toggle1_isr(void){ TFLG1 = 0x04; TC2 += 9091; } void toggle2_isr(void) { TFLG1 = 0x08; TC3 += 4854; }