ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Chung-Ta King National Tsing Hua University
A look at interrupts What are interrupts and why are they needed.
External Interrupt Module MTT EXTERNAL INTERRUPT REQUEST MODULE (IRQ)
I/O Unit.
Processor System Architecture
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
68HC11 Polling and Interrupts
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Computer System Organization S H Srinivasan
A look at interrupts What are interrupts and why are they needed.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
Introduction to Embedded Systems
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
MSP430 Mixed Signal Microcontroller – Parte 2 Afonso Ferreira Miguel Source: slau056d – Texas instruments.
MICROPROCESSOR INPUT/OUTPUT
CoE3DJ4 Digital Systems Design Chapter 6: Interrupts.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
PIC16F877 ISR Points to note Interrupt Triggers –Individual interrupt flag bits are set, regardless of the status of their corresponding mask bit, PEIE.
ECE 447 Fall 2009 Lecture 10: TI MSP430 Timers and Capture Modes.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the CPU architecture.
Lecture 11 Low Power Modes & Watchdog Timers
I/O Interfacing A lot of handshaking is required between the CPU and most I/O devices. All I/O devices operate asynchronously with respect to the CPU.
Microprocessors 1 MCS-51 Interrupts.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides an overview of the CPU architecture.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Microprocessor. Interrupts The processor has 5 interrupts. CALL instruction (3 byte instruction). The processor calls the subroutine, address of which.
WISP.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
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.
I NTRODUCTION TO PIC PROGRAMMING By : S HERIF H ARHASH.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
Lecture 10: TI MSP430 Timers and Capture Modes
Lecture 8: TI MSP430 Interrupts, ISRs
COURSE OUTCOMES OF Microprocessor and programming
CS4101 嵌入式系統概論 Interrupts Prof. Chung-Ta King
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Computer Architecture
Interrupts In 8085 and 8086.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Interrupt.
ECE 3430 – Intro to Microcomputer Systems
Interrupt and Exception Programming
CS4101 Introduction to Embedded Systems Lab 4: Interrupt
* * * * * * * 8051 Interrupts Programming.
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
ECE 3430 – Intro to Microcomputer Systems
CPE 323 Introduction to Embedded Computer Systems: DMA Controller
Lecture 9: TI MSP430 Interrupts & Low Power Modes
ECE 3430 – Intro to Microcomputer Systems
Computer System Overview
Presentation transcript:

ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts

Agenda Polling Introduction to Interrupts Class Example

ECE447: Polling Concept Main Program Cycle continuously Polling routine Signal from device #1? Signal from device #2? Signal from device #N? Service device #1 Service device #2 Service device #N

ECE447: Loop usage for polling events public void main(void) { …. while ( !(P1IN & BIT0) ) ; // Correct …. } public void main(void) { …. while (P1IN & BIT0) { // Incorrect } …. } Loops can be used to poll events (both internal or external). The two examples on the left show the correct and incorrect usage of polling loops. The first loop holds the program in one spot until the condition evaluates false. The semi- colon is equivalent to a pair of empty brackets (“{ }”). This program will only move past this point once P1.0 is high. The second loop processes its contents as long as the condition is true. This usage is discouraged because the condition could change multiple times while the contents of the loop are executing.

ECE447: Loops in C and Assembly C // infinite loops for (;;) { // or while(1) { // do processing } // blocking loops while ( !(P1IN & BIT0) ); // process input // complex conditions while ( !(P1IN & BIT0) && !(P2IN & BIT0) ); // process input Assembly ; infinite loops Label1: ; do processing JMPLabel1; jump always ; blocking loops Label2: BIT.B#BIT0, &P1IN JZLabel2; jump if not set ; process input ; complex conditions Label3: BIT.B#BIT0, &P1IN JNZEnd_loop; jump if set BIT.B#BIT0, &P2IN JNZEnd_loop; jump if set JMPLabel3 End_loop: ; process input

ECE447: Interrupts Concept RETI

Interrupt Applications Urgent Tasks with a Higher priority than the main code Infrequent tasks (handling slow input from humans) Waking the CPU from Sleep Calls to an operating system

Interrupt Features Interrupts can be requested by most peripherals and some core MCU functions Each interrupt has a flag –This flag is “raised” (set) when the condition for the interrupt occurs –Each flag has a corresponding ENABLE bit which allows interrupt requests Maskable Interrupts –Effective only if the General Interrupt Enable (GIE) bit is set in the Status Register

ECE447: MSP430 Interrupts Overview Interrupt processing 1.Program Counter (PC) is stored on the stack 2.Status Register (SR) is stored on the stack 3.Interrupt flag is cleared 4.SR is cleared GIE = 0, disables interrupt Low power modes cancelled 5.PC is set to the calling interrupts vector value (e.g. value stored at 0xFFFC for NMI)

ECE447: Interrupt Trigger Types (Level/Edge) Level Sensitive: Interrupt triggers as long as the source is at certain level (high or low). Edge Sensitive: Interrupt triggers when the source changes from one state to another (high to low, low to high, or both) Note: The MSP430 offers only edge sensitive interrupts, and only one edge may be detected at a time. Interrupt on high level Falling Edge Rising Edge Both Edges

ECE447: External Interrupt Sources PINEvent / InterruptFlags RSTPower up, External Reset, Watchdog timer, Flash memory RSTIFG NMINon-maskable InterruptNMIIFG P1.0-7Pin change (8)P1IFG.0-7 P2.0-7Pin change (8)P2IFG.0-7 USCI input pins Universal Serial Communication Interface: Receive ready signal UCA0RXIFG, UCB0RXIFG USART input pins Universal Serial Asynchronous Receive Transmit: Receive ready signal URXIFG1

ECE447: MSP430 Reset Overview There are two levels to the RESET interrupt –Power-on Reset (POR) Power on (or brownout without SVS) Low signal on the /RST pin –Power-up Clear (PUC) Watchdog timer overflow Incorrect Watchdog password Incorrect flash memory password Fetch from reserved/unimplemented memory Status after RESET –Status Register (SR) cleared (low power modes cancelled) –Register and peripheral defaults initialized rw-0: bit reset to zero after PUC or POR rw-(0): bit reset to zero only after POR (rw = read/write) –Program Counter (PC) set to value stored at 0xFFFE (the reset vector)

ECE447: Internal Interrupt Sources Event / InterruptFlags Oscillator fault, Flash access violationOFIFG, ACCVIFG Timer B0TBCCTL0.CCIFG0 Timer B1 (7)TBCCTL1-6.CCIFG1- 6, TBIFG Comparator ACAIFG Watchdog Timer+WDTIFG Universal Serial Communication Interface: Transmit ready signal UCA0TXIFG, UCB0TXIFG Analog-to-Digital ConverterADC12IFG Timer A0TACCTL0.CCIFG0

ECE447: Internal Interrupt Sources (cont.) Event / InterruptFlags Timer A1 (7)TACCTL1-6.CCIFG1- 6, TAIFG Universal Serial Asynchronous Receive Transmit: Transmit ready signal URXIFG1 Basic Timer 1 / Real Time ClockBTIFG Direct Memory AccessDMA0IFG, DMA1IFG, DMA2IFG Digital-to-Analog ConverterDAC12.0IFG, DAC12.1IFG

ECE447: Class Exercise Write a routine in assembly that polls the P1.1 input pin of the MSP430 for the status of a button. As long as the logic signal on that pin remains high the MSP430 will output the pattern ‘0101’ on pins P1.4 to P1.7. When the button is released the output will invert to ‘1010’. This behavior should repeat indefinitely when the button is pressed and released.

Summary Polling Introduction to Interrupts Class Example