Example 19 Measuring Pulse Widths Using Interrupts

Slides:



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

Microcontroller Programming II MP6-1
Programmable Interval Timer
Introduction of Holtek HT-46 series MCU
Timers Chapter 10 9S12DP256. Timers The 9S12DP256 Programmable Timer Output Compares Pulse Train Using Interrupts Input Capture Measuring the Period of.
Timers Chapter 10. Timers The 68HC12 Programmable Timer Output Compares Input Capture Pulse Accumulator Timing Interrupt Service Routines A Circular Queue.
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.
ATtiny2313 Timers/Counters CS-423 Dick Steflik. What Do You Use Timers For? Timing of events (internal or external)‏ Scheduling Events Measuring the width.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Architecture of the 8051 INTERNAL DATA BUS Oscillator & Timing Programmable I/O (32 Pins) 80C51 CPU 64K byte Expansion Control Serial I/O 4K Program Memory.
1.  8051 Timers “count up,” incrementing the Timer’s respective “count register” each time there is a triggering clock pulse. 2  When the “count register”
NS Training Hardware. System Controller Module.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
Chapter 12 Capturing Input. Di Jasio - Programming 32-bit Microcontrollers in C Button Inputs.
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
ARM Timers.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
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.
The miniDragon+ Board and CodeWarrior Lecture L2.1.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
ECE 447 Fall 2009 Lecture 10: TI MSP430 Timers and Capture Modes.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
Example 11 Analog-to-Digital Converter Lecture L5.1.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
Connector Differential Receiver 8 Channels 65 MHz 12 bits ADC FPGA Receive/buffer ADC data Format triggered Events Generate L1 Primitives Receive timing.
Lecture 22: LM3S9B96 Microcontroller – SysTick and General-Purpose Timers.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Timer 1 and 2 operation, PWM Principles. Timer 1 Operation.
EE 211 Lecture 5 T. H. Ortmeyer Spring, This week’s labs Aliasing and Pulse Measurements 555 Timers Important Note: Next weeks schedule.
Introduction to Digital Electronics Lecture 1 : Background.
Closed Loop Temperature Control Circuit with LCD Display Mike Wooldridge ECE 4330 Embedded Systems.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
Application Case Study Christmas Lights Controller
RASH DRIVING WARNING SYSTEM FOR HIGHWAY POLICE
Why are Timer Functions Important?
Lecture 10: TI MSP430 Timers and Capture Modes
V.V.P. ENGINEERING COLLEGE,RAJKOT
Lecture 8: TI MSP430 Interrupts, ISRs
Example 14 Real-time Interrupts
4-Integrating Peripherals in Embedded Systems
4-Integrating Peripherals in Embedded Systems
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
Example 10 ASCII String to Binary Conversion
Example 5 Pushbutton Switches: S1 and S2
ECE 3430 – Intro to Microcomputer Systems
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)
Programmable Interval timer 8253 / 8254
Example 17 SCI Receive Interrupts
Example 7 Liquid Crystal Display
Programmable Interval timer 8253 / 8254
Example 18 Pulse Train Using Interrupts
ECE 3430 – Intro to Microcomputer Systems
Prof. Chung-Ta King Department of Computer Science
Presentation transcript:

Example 19 Measuring Pulse Widths Using Interrupts Lecture L8.3

PIM_9DP256 Block Diagram Timer module

Timer Pins PT0 – PT7 Pins 9,10,11,12, 15,16,17,18

Timer Pins PT0 – PT7 Pins 9,10,11,12, 15,16,17,18 PT1 = Pin 10

Interrupts on rising and falling edges HI_time LO_time Interrupts on rising and falling edges

MC9S12DP256B Interrupt Vectors

// Example 19: Measuring Input Pulse Widths on Channel 1 #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" // Timer channel 1 interrupt service routine void interrupt 9 handler1(){ HILOtimes1(); // update HI-LO times on Ch 1 }

void main(void) { int period1; // period of input pulse train on Ch 1 int HI_time1; // measured HI time of pulse train on Ch 1 int LO_time1; // measured LO time of pulse train on Ch 1 PLL_init(); // set system clock frequency to 24 MHz lcd_init(); HILO1_init(); while(1) { HI_time1 = get_HI_time1(); // read new HItime1 LO_time1 = get_LO_time1(); // read new LOtime1 set_lcd_addr(0x00); write_int_lcd(HI_time1); // write HItime on row 1 of lcd set_lcd_addr(0x40); write_int_lcd(LO_time1); // write LOtime on row 2 of lcd period1 = HI_time1 + LO_time1; set_lcd_addr(0x14); write_int_lcd(period1); // write period on row 3 of lcd ms_delay(100); }