TKT-3500 Microcontroller systems
|
|
- Brett McGee
- 6 years ago
- Views:
Transcription
1 TKT-3500 Microcontroller systems Lec 3b Interrupts Ville Kaseva Department of Computer Systems Tampere University of Technology Fall 2010
2 Sources Original slides by Erno Salminen Robert Reese, Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media, 2005 Tim Wilmshurst, Designing Embedded Systems with PIC Microcontrollers Principles and applications, Elsevier, Wikipedia #2/52
3 Contents Interrupts Basics, program flow Sources and control registers in PIC Interrupt service routines, state machines Timing #3/52
4 Interrupts
5 Program flow The order in which the individual statements, instructions or function calls of an imperative or functional program are executed or evaluated A control flow statement decides which control flow is taken Control flow statements can be categorized by their effect: continuation at a different statement (jump), executing a set of statements only if some condition is met (choice), repeating a set of statements until some condition is met (loop), executing a set of distant statements, after which the flow of control may possibly return (subroutines, coroutines, and continuations), stopping the program, preventing any further execution (halt) #5/52
6 Program flow (2) In machine or assembly language, control flow instructions usually work by altering the program counter For example, conditional or unconditional branches Interrupts and signals are low-level mechanisms can alter the flow of control in a way similar to a subroutine usually occur as a response to some external stimulus or event interrupts can be though as HW-initiated function calls Reset is also kind of a harsh interrupt Cause CPU to boot up. Covered in lecture 6 #6/52
7 Interrupts Interrupts are used to change the normal flow of a program so that it can perform another (specified) function Allow external events to change (interrupt) the normal flow of the software and then executing code specifically designed as a response The interrupted part of the code does not know what hit it In theory, it may notice it from the RTC (realtime clock) #7/52
8 Interrupts (2) Allow processors to automatically respond to specified events and concentrate processing power on executing a main program Processors without in-built interrupt support require programs which regularly inspect selected input lines. This is called polling or busy wait Polling is very expensive in terms of processing See e.g. previous examples with USART while (something_happened ==0) {} process_data(); #8/52
9 Interrupts - PIC When an interrupt occurs 1. the instruction currently being executed is completed 2. PC jumps to address 0x08 or 0x18 in program memory and executes the instruction stored there, practically GOTO ; ORG 0X00 GOTO START ORG 0X08 GOTO INT_SRVC_HI ; INT VECTOR contaisn just jumps ORG 0X18 GOTO INT_SRVC_LO ; INT VECTOR contaisn just jumps INT_SRVC_HI ; START RETFIE END ; ACTUAL HI-PRIOR ISR HERE ; RETURN FROM INTERRUPT ; MAIN PROGRAM GOES HERE #9/52
10 Interrupt system Interrupts can be enabled or disabled (masked) a) individually per-source b) globally (all disabled regardless of source) Interrupts enabled by INTCON-register s GIE-bit All interrupts have a priority PIC18 has 2 priorities: high or low Before using interrupts, corresponding interrupt source has to be enabled and priority chosen #10/52
11 Interrupt flags Interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global interrupt enable bit -> Allows software polling. User software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt Of course, flag must be cleared also after servicing the interrupt #11/52
12 Interrupt sources #12/52 Interrupts may be triggered based on a) signal edge: rising, falling, either b) signal level: high, low having both levels doesn t make much sense For each source following must be configured first 1. edge or level sensitive, active value 2. reset the flag (if set by default) 3. enable the source Sources may a) have separate interrupt pins, or b) share one interrupt pin
13 Interrupts sensitivity Sensivity INT0 Sometimes certain input pins allow only subset of these choices 1. pos.edge flag is set time 2. neg.edge 3. either edge (change) 4. high level 5. low level Example usage: external device keeps interrupt asserted until serviced. ISR envoked perhaps only once (high in example) or twice (low) #13/52
14 Interrupt sources (2) 29 separate sources 4 external input pins INT0...INT3 multiplexed with PORTB[3:0] 4 other pins GPIO port B Timers Peripherals parallel slave port AD-converter EUSART rx, tx MSSP capture-compare-pwm module (CCP/ECCP) #14/52
15 Interrupt sources(3) Note that occurrence of interrupt request always sets the corresponding flag Interrupt disable prevents the jump to interrupt vector Once enabled again, the previously set flag will cause the interrupt #15/52
16 Control registers for interrupts 10 registers are used to control interrupts reset control RCON interrupt control INTCON, INTCON2,INTCON3 peripheral interrupt flags PIR1, PIR2, PIR3 peripheral interrupt enable PIE1, PIE2, PIE3 interrupt priority IPR1, IPR2, IPR3 #16/52
17 Interrupt service routine (ISR)
18 #18/52 Interrupt service routine (ISR) Function to perform the necessary actions Called automatically after interrupt request Calls (GOTOs) are placed into interrupt vector Accepts no parameters Does not return any values May modify global variables, though Remember to use volatile qualifier Must ensure not to mess up the CPU state Two ISRs in PIC: high and low priorities High prior. interrupt may pre-empt lower priority but not vice versa
19 Entering Interrupt service routine When entering ISR 1. registers BSR, W, STATUS are saved automatically to shadow registers In general, all CPU s registers must be saved Shadow registers allow fast save/restore but increase area 2. Return address is pushed automatically on the stack 3. Usually, all interrupts are disabled a) usually implicitly b) sometimes by the programmer at least those with lower priority #19/52
20 Entering Interrupt service routine (2) 4. Programmer may store other context information manually In PIC, e.g. multiplier register MULH+ MULL Any special function registers utilized in ISR 5. In PIC, the source of interrupt has to be checked manually in ISR Since interrupts are shared by multiple sources Other CPUs may have a) separate interrupt pins and ISRs b) register denoting the source which simplify ISR code #20/52
21 Exiting ISR Actions during exit are reversed from those during entering Restoring context requires special attention as certain instructions affect STATUS register Does not use the same machine-code for return as regular functions RETFIE instead of RETURN No values returned Context may restored from shadow regs instead of stack Interrupts must be enabled again #21/52
22 ISR in ASM as. Location defined by linker because shadow registers may be taken by higher prior ISR W is stored first with movwf which does not affect STATUS flags.. Note the order! STATUS is restored last because previous restorations affect the flags. Parameter 0 for retfie tells not to restore from shadow registers. #22/52
23 Interrupts vs. traps A trap is a special non-maskable interrupt Not supported by all CPUs Higher priority than any regular interrupt Hard trap : some type of HW failure Soft trap: triggered by some instruction Examples: divide-by-zero invalid memory address user SW calls OS function that must be executed in privileged (supervisor) mode On this course, we will not consider traps #23/52
24 Program flow example 1. CPU is reset 2. Reset vector points to initialization function (usually compilergenerated) 3. Execution jumps to main() 4. Main() calls other functions 5. Function foo() is interrupted, PC points to interrupt vector 6. ISR is executed 7. Execution returns to foo() to the instruction following the last executed one 8. Function foo may call other functions 9. Execution returns from bar to foo 10. Execution returns from foo to main 11. Main remains in infinite loop unless other interrupts occur x0 Program memory rst vec isr vec init(){... GOTO main} isr() {... retfie} main(){... foo()... while(1){} foo() {... bar()... return bar(){... return #24/52
25 Critical Section When the main program and ISR share common data structures (e.g. global variables), accessing that data is a potential synchronization problem The main program is at critical section when handling/processing such data Interrupts should be denide when the main progarm is at critical section modifying the shared data Denying interrupts aka. preserving atomicity aka. Uniterruptible Remember volatile #25/52
26 ISR example
27 Polled IO vs. interrupt-driven Polled IO CPU checks continuouly the status of the transfer Wastes time for checking, cannot do anything else Trade-off between Check often excess overhead Check seldom small overhead, events may be missed Interrupt-driven IO CPU can perofrm other tasks while transfers is being completed by special HW CPU can sleep while waiting for incoming data Modern computers use interrupt-driven IO #27/52
28 Polled/Int-drv IO example (1) Polled mobile phone without ring indicator Check mobile phone every now and then Take it from your pocket, purse what ever... Hello, is someone calling? How often should you check? How long will the callers wait on line for you perhaps answering? Ain t this the coolest gadget or what... #28/52
29 Polled/Int-drv IO example (2) Interrupt-driven regular mobile phone You ll be noticed (interrupted) when a call or SMS arrives Call/SMS may arrive asynchronously You may disable interrupts but can check the flags later Seems more convenient and efficient Interrupts may be nested you ll can put the current call on hold when some VIP calls Important persons have higher priority You may accept only certain calls (e.g. during night time) #29/52
30 Polled IO example unsigned char getch (void) { } while (RCIF==0); return (RCREG); unsigned char getche (void) { } /* called by library function scanf */ unsigned char c; c = getch() putch (c); /* echo */ return c; void main (void) { char param =0; serial_init (95,1) /* etc. */ printf ( Starting. ); printf ( Feed the input values. ); while (1) { scanf( %i, &c); transmogrify (param); printf ( Result is %i, param); } } #30/52
31 Polled IO example (2) Example works well, when input comes at low rate However, transmogrify and printf may take quite a while No values are accepted when those functions are being processed When values come in bursts, some may be lost If USART overrun occurs, scanf gets stuck Aargh. overrun! Voi poltetun poltettu! #31/52 param arrives ok ok ok ok time
32 Buffering and state machines
33 Handling bursts with buffering Data may be buffered before processing Buffer must be larger enough accomodate the largest possible burst In the long run, the processing rate must be larger than incoming data rate Otherwise, every buffer will overflow at some point Use flow control to avoid buffer overflows Burst are followed by period of less activity when the buffered params can be handled param arrives ok ok ok ok time #33/52 1. Params handled at the same as they arrive 2. Burst is stored temporarily into buffer 3. Params from buffer are handled
34 Handling bursts with buffering (2) Buffer works with FIFO principle Firstin, first out The buffer may be implemented on HW fixed size e.g. two-word buffer on SW flexible size The appropriate size depends on data rate and burstiness of traffic Obviously, fixed size buffer does not work always #34/52
35 SW FIFO buffer SW buffer is an array with two pointers head where the new data is stored tail from where the data is read Data is not copied from location to another but the pointers are updated #35/52
36 SW FIFO buffer (2) Pointers wrap to the beginning when incremented enough so called circular buffer Head equals tail when FIFO is empty If head catches the tail, overrun occurs (fig c) There are different policies for pointers, e.g. increment head and then write, head++; buf[head] = new_data; write and then increment head buf[head] = new_data; head++; Be sure to document properly! Aargh. At most n-1 words stored: 8-slot FIFO can hold 7 data words. #36/52
37 Buffered interrupt-driven IO example Let s modify previous example Use circular buffer (a SW FIFO) Interrupt service routine will place incoming data into buffer Example does not check overrun, though getch() function will read from the buffer It waits until there is some data main() is the same, except that interrupts are enabled #37/52
38 Buffered interrupt-driven IO example (2) #define BUF_MAX 32 volatile unsigned char ibuf[buf_max], head, tail; unsigned char getch () { /* this is called by scanf*/ while (head==tail); tail++ tail %=BUF_MAX; return ibuf[tail] } void interrupt pic_isr(void) { if (RCIF) { head++; /* no check for overrrun */ head %= BUF_MAX; ibuf[head] = RCREG; } void main (void) { char param =0; serial_init (95,1) /* etc. */ IPEN=0; RCIE=1; PEIE=1; GIE=1; printf ( Starting. ); printf ( Feed the input values. ); while (1) { scanf( %i, &c); transmogrify (param); printf ( Result is %i, param); } } /* getche() unchanged */ #38/52
39 State machine State changes when user presses button connected to RB0 Initally, led is off Start when user presses button LED starts blinking It keeps blinking until user presses button and switch connected RB7 goes low Keep LED lighted until button is pressed again turn off the led return to start state #39/52
40 State machine s ISR Global semaphore variables ISR updates these, main just reads (except int_flag) Remove bounce from button input Clear flag bit Notify main via global var that int occurred Go to next state Check switch position first when blinking Update the led s status blink/on/off #40/52
41 State machine s main function After initialization, loop forever Read semaphores updated by the ISR Control the led (RB4) Print also state information for debug purposes #41/52
42 State machine s behavior off on #42/52
43 Interrupt overhead
44 Interrupt latency and overhead Interrupt latency denotes the time between 1. occurrence of interrupting event 2. entering the ISR Interrupt overhead means the CPU time taken by the ISR Both are critical in real-time systems CPU must react to external events within bounded time (small/bounded latency) ISR prevents the main from running and may hence distract its timing (small/bounded overhead) #44/52
45 Interrupt latency and overhead (2) Disabling interrupts increases latency! Disabled when processing critical section, such as data structure shared/accessed by multiple entities (functions, SW/HW) All/Lower priority interrupts are automatically disabled when entering ISR Flags must be checked when exiting ISR The disable duration must be minimized The duration of ISR must be minimized no printf() Debug info must be placed into trace buffer variable and print them in main code no wait statements #45/52
46 Interrupt latency and overhead (3) Interrupts arrive asynchronously! One cannot predict their occurrence Must prepare for their arrival at any point Even within another ISR As much as possible of the work must be done in main code whereas ISR handles the time-critical parts Operating system may enlongen the ISR latency #46/52
47 ISR enter latency Current instruction is finished first Note that interrupt disable causes indefinite delay Save PC and jump to interrupt vector Jump to ISR Note that figure is for PIC24 but the principle is the same. #47/52
48 ISR exit latency Perform retfie instruction Retrieve context Jump back to main code #48/52
49 ISR overhead IEntry - #instr cycles when entering ISR IBody - #instr cycles within ISR IExit - #instr cycles when exiting ISR f ISR = 1 / t ISR frequency of interrupt triggering is reciprocal of triggering period Overhead ISR = ((IEntry + IBody + Iexit) * f ISR ) / f CPU Example, IEntry =4, IBody=50, IExit=3, f CPU =40 MHZ t ISR = 10 ms means 0.01 % overhead t ISR = 1 ms means 0.14% overhead t ISR = 0.1 ms = 100 us means 1.43 % overhead t ISR = 0.01 ms = 10 us means 14.3 % overhead #49/52
50 Interrupt Handlers No portable way to write interrupt handlers a) Either use assembler code stubs for interrupt handlers b) Or use processor/compiler specific extensions to C This is a consequence of register allocation and stack management policies of compilers and operating systems Ensure mutual exclusion when updating global variables from interrupt handlers E.g. main disables interrupts when accessing global variables #50/52
51 Interrupt Handlers (2) Global variables updated from interrupt handlers (semaphores) are often marked volatile volatile char isr_rdy; void main() {... while (isr_rdy == 0) {} This way, isr_rdy is read on every loop iteration Compiler optimization forbidden Updates from interrupt handler are visible and while can terminaite #51/52
52 C syntax for ISR with PIC # pragma interrupt function-name [tmp-sectionname][save=save-list][nosave=nosave-list] Pragmas are preprocessor commands Define additional information for compiler -> typically compiler dependant, not C standard defined This associates the user defined function-name with interrupt vector That function becomes the ISR [tmp-section-name] [save-list] List of variables or data sections to save in ISR Compiler guesses otherwise (usually OK) [nosave-list] List of variables or data sections not to save in ISR #52/52
53 Conclusions Interrupts allow handling of asynchronous external events Parallel execution, caution required! May happen any time come like a fax to prime minister Interrupt service routines are very time-sensitive Must react fast Must not interfere with main code timing Do as much as work as possible in main code Compared to polled IO Increase the performance Achieve the same performance with lower enegy (wake from sleep with interrupt) #53/52
Interrupts. ELEC 330 Digital Systems Engineering Dr. Ron Hayne. Images Courtesy of Ramesh Gaonkar and Delmar Learning
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning Basic Concepts of Interrupts An interrupt is a communication process A device Requests
More informationHi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan
Interrupts and Resets Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Interrupts An event that will cause the CPU to stop the normal program execution
More informationECE 354 Introduction to Lab 2. February 23 rd, 2003
ECE 354 Introduction to Lab 2 February 23 rd, 2003 Fun Fact Press release from Microchip: Microchip Technology Inc. announced it provides PICmicro field-programmable microcontrollers and system supervisors
More informationELCT 912: Advanced Embedded Systems
ELCT 912: Advanced Embedded Systems Lecture 10: Applications for Programming PIC18 in C Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering Programming the PIC18 to transfer
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 informationInterrupts Peter Rounce
Interrupts Peter Rounce P.Rounce@cs.ucl.ac.uk 22/11/2011 11-GC03 Interrupts 1 INTERRUPTS An interrupt is a signal to the CPU from hardware external to the CPU that indicates than some event has occured,
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 informationEmbedded Software TI2726 B. 4. Interrupts. Koen Langendoen. Embedded Software Group
Embedded Software 4. Interrupts TI2726 B Koen Langendoen Embedded Software Group What is an Interrupt? Asynchronous signal from hardware Synchronous signal from software Indicates the need for attention
More informationECE 354 Computer Systems Lab II. Interrupts, Strings, and Busses
ECE 354 Computer Systems Lab II Interrupts, Strings, and Busses Fun Fact Press release from Microchip: Microchip Technology Inc. announced it provides PICmicro field-programmable microcontrollers and system
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 informationThese 3 registers contain enable, priority,
8.3.2) Registers Related to Interrupts These registers enable/disable the interrupts, set the priority of the interrupts, and record the status of each interrupt source. RCON INTCON, INTCON2, and INTCON3
More informationPC Interrupt Structure and 8259 DMA Controllers
ELEC 379 : DESIGN OF DIGITAL AND MICROCOMPUTER SYSTEMS 1998/99 WINTER SESSION, TERM 2 PC Interrupt Structure and 8259 DMA Controllers This lecture covers the use of interrupts and the vectored interrupt
More informationChapter 10 Sections 1,2,9,10 Dr. Iyad Jafar
Starting with Serial Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Outline Introduction Synchronous Serial Communication Asynchronous Serial Communication Physical Limitations Overview of PIC 16 Series The
More informationMicro-Controller: PIC16C74 < Part 5: Interrupt >
Micro-Controller: PIC16C74 < Part 5: Interrupt > I. Overview Introduction PIC16c74 can have many sources of interrupt. These sources generally include one interrupt source for each peripheral module, though
More informationThe Kernel Abstraction
The Kernel Abstraction Debugging as Engineering Much of your time in this course will be spent debugging In industry, 50% of software dev is debugging Even more for kernel development How do you reduce
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 informationHardware OS & OS- Application interface
CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts
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 informationChapter 11: Interrupt On Change
Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most
More information8086 Interrupts and Interrupt Responses:
UNIT-III PART -A INTERRUPTS AND PROGRAMMABLE INTERRUPT CONTROLLERS Contents at a glance: 8086 Interrupts and Interrupt Responses Introduction to DOS and BIOS interrupts 8259A Priority Interrupt Controller
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 informationSystems Programming and Computer Architecture ( ) Timothy Roscoe
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 AS 2016 Exceptions 1 17: Exceptions Computer Architecture
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 informationInterrupts 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 informationInterrupts L33-1. Interrupts
L33-1 Interrupts Interrupts Interrupts are like receiving a telephone call while you are in a face-to-face meeting: The phone rings (ie, an interrupt is sent) Tell the person you are meeting with to please
More informationTKT-3500 Microcontroller systems
TKT-3500 Microcontroller systems Lec 3a Serial Input/output Ville Kaseva Department of Computer Systems Tampere University of Technology Fall 2010 Sources Original slides by Erno Salminen Robert Reese,
More informationReal-Time Programming
Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold rtp@hte.com 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization
More informationHi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan
PIC18 Serial Port Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Serial vs. parallel data transfer 2 Simplex, half-, and full-duplex transfers 3
More informationInterrupts 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 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 informationInterrupts on PIC18F252 Part 2
Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 TOPICS TODAY I/O Architectures Interrupts Exceptions FETCH EXECUTE CYCLE 1.7 The von Neumann Model This is a general
More informationProtection and System Calls. Otto J. Anshus
Protection and System Calls Otto J. Anshus Protection Issues CPU protection Prevent a user from using the CPU for too long Throughput of jobs, and response time to events (incl. user interactive response
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 informationEmbedded Systems Programming and Architectures
Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics
More informationThe Kernel Abstraction. Chapter 2 OSPP Part I
The Kernel Abstraction Chapter 2 OSPP Part I Kernel The software component that controls the hardware directly, and implements the core privileged OS functions. Modern hardware has features that allow
More informationInterrupts & 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 informationTasks. Task Implementation and management
Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration
More informationProcess Coordination and Shared Data
Process Coordination and Shared Data Lecture 19 In These Notes... Sharing data safely When multiple threads/processes interact in a system, new species of bugs arise 1. Compiler tries to save time by not
More informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Last Class: Intro to OS An operating system is the interface between the user and the architecture. User-level Applications
More informationAn overview of Interrupts ECE3534
An overview of errupts ECE3534 Microprocessor erfacing: errupts Suppose a peripheral intermittently receives data, which must be serviced by the processor The processor can poll the peripheral regularly
More informationEE6008-Microcontroller Based System Design Department Of EEE/ DCE
UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE
More information12.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 informationInterrupts on PIC18F252 Part 2. Interrupts Programming in C Language
Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the
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 informationQ.1 Explain Computer s Basic Elements
Q.1 Explain Computer s Basic Elements Ans. At a top level, a computer consists of processor, memory, and I/O components, with one or more modules of each type. These components are interconnected in some
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 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 informationInterrupt/Timer/DMA 1
Interrupt/Timer/DMA 1 Exception An exception is any condition that needs to halt normal execution of the instructions Examples - Reset - HWI - SWI 2 Interrupt Hardware interrupt Software interrupt Trap
More informationInterrupts in Zynq Systems
Interrupts in Zynq Systems C r i s t i a n S i s t e r n a U n i v e r s i d a d N a c i o n a l d e S a n J u a n A r g e n t i n a Exception / Interrupt Special condition that requires a processor's
More informationComputer architecture. A simplified model
Computer architecture A simplified model Computers architecture One (or several) CPU(s) Main memory A set of devices (peripherals) Interrupts Direct memory access Computers architecture Memory Keyboard
More informationECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University
ECEN 449 Microprocessor System Design Hardware-Software Communication 1 Objectives of this Lecture Unit Learn basics of Hardware-Software communication Memory Mapped I/O Polling/Interrupts 2 Motivation
More informationThis section covers the MIPS instruction set.
This section covers the MIPS instruction set. 1 + I am going to break down the instructions into two types. + a machine instruction which is directly defined in the MIPS architecture and has a one to one
More information1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...
Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,
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 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 informationComputer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.
BASIC ELEMENTS Simplified view: Processor Slide 1 Computer System Overview Operating Systems Slide 3 Main Memory referred to as real memory or primary memory volatile modules 2004/S2 secondary memory devices
More informationProcesses. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?
Processes Process Management Chapter 3 1 A process is a program in a state of execution (created but not terminated) Program is a passive entity one on your disk (survivor.class, kelly.out, ) Process is
More informationLast 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture
Last 2 Classes: Introduction to Operating Systems & C++ tutorial User apps OS Virtual machine interface hardware physical machine interface An operating system is the interface between the user and the
More informationA First Look at Microprocessors
A First Look at Microprocessors using the The General Prototype Computer (GPC) model Part 4 Ports CPU Ecosystem All CPUs need RAM, ROM, a clock source and reset circuit, and power. Power Supply 1 Vio Vcore
More informationCPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf
CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors. I/O devices Usually includes some non-digital component. Typical digital interface to CPU: CPU status reg data reg mechanism Application:
More informationManaging High-Rate Interrupts in Multitasking Applications on Low-Cost Embedded Systems
Managing High-Rate Interrupts in Multitasking Applications on Low-Cost Embedded Systems speaker: Andrew E. Kalman, Ph.D. President, Pumpkin, Inc. Slide 1 Part I Why Use Interrupts? Slide 2 Synchronous
More informationCENG-336 Introduction to Embedded Systems Development. Timers
CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency
More informationECE332, Week 8. Topics. October 15, Exceptions. Hardware Interrupts Software exceptions
ECE332, Week 8 October 15, 2007 1 Topics Exceptions Hardware Interrupts Software exceptions Unimplemented instructions Software traps Other exceptions 2 1 Exception An exception is a transfer of control
More informationGUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III
GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III Subject Name: Operating System (OS) Subject Code: 630004 Unit-1: Computer System Overview, Operating System Overview, Processes
More informationEEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1
EEL 4744C: Microprocessor Applications Lecture 7 Part 1 Interrupt Dr. Tao Li 1 M&M: Chapter 8 Or Reading Assignment Software and Hardware Engineering (new version): Chapter 12 Dr. Tao Li 2 Interrupt An
More informationReading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1
Reading Assignment EEL 4744C: Microprocessor Applications Lecture 7 M&M: Chapter 8 Or Software and Hardware Engineering (new version): Chapter 12 Part 1 Interrupt Dr. Tao Li 1 Dr. Tao Li 2 Interrupt An
More informationInterrupt Basics Karl-Ragmar Riemschneider
Interrupt Basics Exceptions and Interrupts Interrupts Handlers vs. Subroutines Accept or hold Pending: Priority control Exception vector table Example Karl-Ragmar Riemschneider Exceptions
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 (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts
More informationUnit 2 : Computer and Operating System Structure
Unit 2 : Computer and Operating System Structure Lesson 1 : Interrupts and I/O Structure 1.1. Learning Objectives On completion of this lesson you will know : what interrupt is the causes of occurring
More informationMicrocontroller basics
FYS3240 PC-based instrumentation and microcontrollers Microcontroller basics Spring 2017 Lecture #4 Bekkeng, 30.01.2017 Lab: AVR Studio Microcontrollers can be programmed using Assembly or C language In
More informationEEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1
EEL 4744C: Microprocessor Applications Lecture 7 Part 2 M68HC12 Interrupt Dr. Tao Li 1 Reading Assignment Software and Hardware Engineering (New version): Chapter 12 or SHE (old version) Chapter 8 And
More informationPIC Discussion By Eng. Tamar Jomaa
PIC Discussion By Eng. Tamar Jomaa 1 Write assembly language instructions to clear the general purpose registers of PIC16F84A microcontroller (don t write the whole program) 2 Islamic university Electrical
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 informationComputer System Overview
Computer System Overview Operating Systems 2005/S2 1 What are the objectives of an Operating System? 2 What are the objectives of an Operating System? convenience & abstraction the OS should facilitate
More informationMICROPROCESSOR 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 informationLecture 5: MSP430 Interrupt
ECE342 Intro. to Embedded Systems Lecture 5: MSP430 Interrupt Ying Tang Electrical and Computer Engineering Rowan University 1 How A Computer React to Inputs? Polling: the processor regularly looks at
More informationIn examining performance Interested in several things Exact times if computable Bounded times if exact not computable Can be measured
System Performance Analysis Introduction Performance Means many things to many people Important in any design Critical in real time systems 1 ns can mean the difference between system Doing job expected
More informationApril 4, 2001: Debugging Your C24x DSP Design Using Code Composer Studio Real-Time Monitor
1 This presentation was part of TI s Monthly TMS320 DSP Technology Webcast Series April 4, 2001: Debugging Your C24x DSP Design Using Code Composer Studio Real-Time Monitor To view this 1-hour 1 webcast
More informationECE/CS 5780/6780: Embedded System Design
ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 8: Interrupt Synchronization Scott R. Little (Lecture 8: Interrupts) ECE/CS 5780/6780 1 / 22 Administrivia Midterm 1 will be on February
More informationDefinition: An operating system is the software that manages resources
13-1 Operating Systems 13-1 Definition: An operating system is the software that manages resources in a computer. Resources A resource is (usually) hardware that needs to be accessed. There are rules for
More informationInterrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016
Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016 1 Interrupts Motivation Implementation Material from Stellaris LM3S1968 Micro-controller Datasheet Sections 2.5 and 2.6 2 Motivation
More information1 Execution of main program is suspended. 2 All registers are pushed onto the stack. 3 The ISR, or background thread, is executed.
Introduction ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 7: Interrupt Synchronization Interrupts provide guarantee on response time. Interrupts allow response to rare but important
More informationMPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine
MPLAB SIM MPLAB IDE Software Simulation Engine 2004 Microchip Technology Incorporated MPLAB SIM Software Simulation Engine Slide 1 Welcome to this web seminar on MPLAB SIM, the software simulator that
More informationComputer Systems Lecture 9
Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions
More informationEmbedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.
Embedded Systems Design (630470) Lecture 4 Memory Organization Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Memory Organization: PIC16F84 has two separate memory blocks, for data and for program. EEPROM
More informationMicrocontroller systems Lec 2 PIC18LF8722 Microcontroller s s core
TKT-3500 Microcontroller systems Lec 2 PIC18LF8722 Microcontroller s s core Erno Salminen Copyright notice Some figures by Robert Reese, from supplementary CD of the course book from PIC18F8722 Family
More informationINPUT/OUTPUT ORGANIZATION
INPUT/OUTPUT ORGANIZATION Accessing I/O Devices I/O interface Input/output mechanism Memory-mapped I/O Programmed I/O Interrupts Direct Memory Access Buses Synchronous Bus Asynchronous Bus I/O in CO and
More informationChapter 12. CPU Structure and Function. Yonsei University
Chapter 12 CPU Structure and Function Contents Processor organization Register organization Instruction cycle Instruction pipelining The Pentium processor The PowerPC processor 12-2 CPU Structures Processor
More informationWireless Sensor Networks (WSN)
Wireless Sensor Networks (WSN) Operating Systems M. Schölzel Operating System Tasks Traditional OS Controlling and protecting access to resources (memory, I/O, computing resources) managing their allocation
More informationAccessing I/O Devices Interface to CPU and Memory Interface to one or more peripherals Generic Model of IO Module Interface for an IO Device: CPU checks I/O module device status I/O module returns status
More information13-2 EE 4770 Lecture Transparency. Formatted 8:18, 13 March 1998 from lsli
13-1 13-1 Operating Systems Definition: An operating system is the software that manages resources in a computer. Resources A resource is (usually) hardware that needs to be accessed. There are rules for
More informationFredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.
SECOND шт. Assembly and С Programming forthefreescalehcs12 Microcontroller Fredrick M. Cady Department of Electrical and Computer Engineering Montana State University New York Oxford Oxford University
More informationReset, Interrupts, Exceptions, and Break ECE 3534
Reset, Interrupts, Exceptions, and Break ECE 3534 1 Reset, Interrupts, Exceptions, Break These topics are closely related Both software and hardware aspects of a processor are involved On the MicroBlaze,
More informationInterrupts (Exceptions) Gary J. Minden September 11, 2014
Interrupts (Exceptions) Gary J. Minden September 11, 2014 1 Interrupts Motivation Implementation Material from Stellaris LM3S1968 Micro-controller Datasheet Sections 2.5 and 2.6 2 Motivation Our current
More informationIntroduction to Embedded Systems. Lab Logistics
Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis Today s topics: lab logistics interrupt synchronization reentrant code 1 CS 5780 Lab Logistics Lab2 Status Wed: 3/11 teams have completed their
More informationProcess Scheduling Queues
Process Control Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationCSC227: Operating Systems Fall Chapter 1 INTERRUPTS. Dr. Soha S. Zaghloul
CSC227: Operating Systems Fall 2016 Chapter 1 INTERRUPTS Dr. Soha S. Zaghloul LAYOUT 1.3 Devices Controlling Techniques 1.3.1 Polling 1.3.2 Interrupts H/W Interrupts Interrupt Controller Process State
More information