Example 14 Real-time Interrupts

Slides:



Advertisements
Similar presentations
Review: Interrupts & Timers
Advertisements

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,
68HC11 Polling and Interrupts
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
C and Assembler Subroutines: Using the LCD. Outline Basic structure of CW-created C programs for the HC12 How to incorporate assembly code How to use.
Example 11 Analog-to-Digital Converter Lecture L5.1.
C Language Programming. C has gradually replaced assembly language in many embedded applications. Data types –C has five basic data types: void, char,
Chapter 6 Interrupts and Resets
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
Interrupts CML-12C32 Lecture L4.2.
LAB 7: WDT+ and Low-Power Optimization
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
Slides created by: Professor Ian G. Harris Interrupts  Embedded systems often perform some tasks which are infrequent and possibly unpredictable Hang.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
The miniDragon+ Board and CodeWarrior Lecture L2.1.
Lecture 11: TI MSP430 Timers Compare Modes
AVR Programming: Interrupts September 17, What are interrupts? An asynchronous signal indicating the need for an event to be handled A synchronous.
ECE 371 – Unit 9 Interrupts (continued). Example Set up Two Interrupt Request Inputs: –Port H[0] Set Interrupt Flag on “0” to “1” transition (rising edge)
Serial Communication Interface Ta Kim Nicholas Earnhart Razid Ahmad ME 6405 – Fall 2008 November 6, 2008.
Lab 5 – Digital Clock Start date: Week #8 Due date: Week #9 REPORT IS DUE WEEK #9 1.
Example 11 Analog-to-Digital Converter Lecture L5.1.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
The Serial Communication Interface (SCI) MC9S12-C32
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
Chapter 5 - Interrupts.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
1 Round Robin Non-Preemptive Scheduler Lecture 12.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
ELE22MIC Lecture 17 Writing 68HC11 software 68HC11 Main Timer System –Output Compare –What is different about TOC1?
Timers and Scheduled Interrupts
Mixing C and ASM Programs
HCS12 Exceptions Maskable Interrupts
ELE22MIC Lecture 18 Writing 68HC11 software 68HC11 Main Timer System
ECE 3430 – Intro to Microcomputer Systems
80C51 Block Diagram ECE Overview.
Microprocessor and Assembly Language
Lesson Outline Interrupts Admin Assignment #9 due next lesson
68HC11 Interrupts & Resets.
Buffered, Interrupt-Driven Printer Design Example
ECE 3430 – Intro to Microcomputer Systems
4-Integrating Peripherals in Embedded Systems
ELE22MIC Lecture 18 Writing 68HC11 software 68HC11 Main Timer System
Example 19 Measuring Pulse Widths Using Interrupts
Round Robin Non-Preemptive Scheduler
4-Integrating Peripherals in Embedded Systems
Buffered, Interrupt-Driven Printer Design Example
Refer to Chapter 3 in the reference book
ECET 330 Innovative Education--snaptutorial.com
Example 10 ASCII String to Binary Conversion
Example 5 Pushbutton Switches: S1 and S2
Oct 25 Announcements HW 8 posted
Example 9 Binary to ASCII String Conversion
Example 6 Hex Keypad Lecture L3.2.
Example 15 Interrupt-Driven Controller
Interrupts in C Programs
Example 16 Circular Queue
Example 13 The Serial Peripheral Interface (SPI)
전자의료시스템 및 실습 System Configuration/Interrupt
Example 17 SCI Receive Interrupts
Example 7 Liquid Crystal Display
Resets & Interrupts.
Interrupt-Driven State Machine
Example 18 Pulse Train Using Interrupts
EECE.3170 Microprocessor Systems Design I
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Independent timers build into the processor
Presentation transcript:

Example 14 Real-time Interrupts Lecture L6.1

Register Stacking for Interrupts

MC9S12DP256B Interrupt Vectors

void interrupt 7 handler(){ << you C code goes here >> } Writing interrupt service routines in C and setting the interrupt vector Vector number for real-time interrupt void interrupt 7 handler(){ << you C code goes here >> }

Real-Time Interrupt Registers $0037

$0038

Real-time Interrupts $003B

; Real-time interrupt ; RTI_init(); RTI_init: sei ;disable interrupts ldaa #$59 staa RTICTL ;set rti to 10.24 ms ldaa #$80 staa CRGINT ;enable rti cli ;enable interrupts rts ; clear_RTI_flag(); clear_RTI_flag: ldaa #$80 staa CRGFLG ;clear rti flag rts

// Example 14: Real-time interrupt #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void half_sec_delay(void); unsigned short ticks, ticks0; // RTI interrupt counts // RTI Interrupt Service Routine void interrupt 7 handler(){ ticks++; clear_RTI_flag(); }

void main(void) { PLL_init(); // set system clock frequency to 24 MHz seg7_enable(); RTI_init(); while(1) { seg7dec(8); // display 8 on 7seg display half_sec_delay(); seg7_off(); // turn off 7seg display } void half_sec_delay(void){ // delay for 0.5 seconds ticks0 = ticks; while((ticks-ticks0)<49) {