MCO556 Timer System Exercise.

Slides:



Advertisements
Similar presentations
More fun with Timer/Counters
Advertisements

8253/54 Timer Section /54 Timer Description and Initialization
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,
EET 2261 Unit 10 Enhanced Capture Timer  Read Almy, Chapter 20.  Homework #10 and Lab #10 due next week.  Quiz next week.
Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.
Timers Chapter 10 9S12DP256. Timers The 9S12DP256 Programmable Timer Output Compares Pulse Train Using Interrupts Input Capture Measuring the Period of.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
1 Timing System Timing System Applications. 2 Timing System components Counting mechanisms Input capture mechanisms Output capture mechanisms.
ENG3640 Microcomputer Interfacing Week #6 Timing Generation and Measurement.
8254 Programmable Interval Timer
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Timer/counter Chapter 12
ARM Timers.
System Clocks.
M Semiconductor Products Sector Computer Operating Properly Module Detail Slide #1 of 7 Tutorial Introduction PURPOSE -To explain how to configure and.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
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.
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
Timers.
ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.
Chapter 11: Timer Subsystem Esteban Rodriguez-Marek Eastern Washington University Department of Engineering & Design.
ELE22MIC Lecture 15 Applications of Parallel Input Output (I/O)
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
University of Tehran 1 Microprocessor System Design Timers Omid Fatemi
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
8254 Timer.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
Timers Presented by: Griffin Reid Rohit Vardhan Freddie Wilson Date: October 25, 2005.
Seth Schwiethale James Crosetto James Ellison.  square pulse of ms, repeats every 20 ms  It is the same for both steering and acceleration 
ELE22MIC Lecture 17 Writing 68HC11 software 68HC11 Main Timer System –Output Compare –What is different about TOC1?
Microprocessors A practical approach..
EET 2261 Unit 13 Enhanced Capture Timer
16F877A.
Why are Timer Functions Important?
Lecture 10: TI MSP430 Timers and Capture Modes
ELE22MIC Lecture 18 Writing 68HC11 software 68HC11 Main Timer System
ECE 3430 – Intro to Microcomputer Systems
Timer and Interrupts.
ELE22MIC Lecture 18 Writing 68HC11 software 68HC11 Main Timer System
RX Watchdog Timer (WDT)
Programmable Interval Timer
AVR Addressing Modes Subject: Microcontoller & Interfacing
Oct 30 Announcements Code Marked and on Blackboard
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Timer/Counter Modified from Dr. Lam Phung’s Slides.
Oct 30 Announcements Code Marked and on Blackboard
8254 Timer and Counter (8254 IC).
Timer.
Timers.
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
Example 18 Pulse Train Using Interrupts
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
8085 Microprocessor Architecture
Programmable Interval Timer
Timers Chapter 2.
Presentation transcript:

MCO556 Timer System Exercise

Timer System Exercise Using the HCS12 Timer System, generate a ~8 Hz overflow rate which will control the system loop timing. The Timer System must also be used to generate a 200 Hz square wave on PORT T pin 2. Calculate the Timer System parameters required to configure the system.

Timer System Diagram Prescaler Divide by 216 TOF in TFLG2 ~ 8 Hz Bus Clock Fbus = 8 MHz Fct Fov DFF P TCNT Tcmp C2F in TFLG1 DFF Comparator PTT.2 Fsw = 200 Hz TC2 TFF

Prescale Calculation 1) Overflow rate is Fov = ~8 Hz 2) The TCNT counter divides its input clock (Fct) by 2^16 to generate Fov 3) TCNT clock frequency is Fct = 216 * Fov Fct = 2^16 * 8 Hz = ~524288 Hz 4) The 8 MHz Bus clock (Fbus) is divided by the prescaler (P) to generate Fct. Fbus / P = Fct P = Fbus / Fct P = 8MHz / 524288 Hz = 15.26 The nearest available prescale value is 16 = 24.

Actual TCNT Clock Tct = 1 / 0.5 MHz = 2 us 1) When using the prescale value of 16, the clock rate into the TCNT counter is Fct = Fbus / P Fct = 8 Mhz / 16 = 0.5 MHz 2) Clock period is Tct = 1 / Fct Tct = 1 / 0.5 MHz = 2 us

Compare Event Timing 1) Port T.2 generates a 200 Hz square wave. This requires using Timer channel 2 in Output Compare mode. 2) Square Wave period is Tsw = 1/ Fsw Tsw = 1 / 200 Hz = 5 ms 3) The compare period (Tcmp) is half the square wave period. Tcmp = 0.5 * 5 ms = 2.5 ms

Compare Event Interval 1) The Output Compare event occurs every 2.5 ms. This is equivalent to M cycles of the TCNT clock M = Tcmp / Tct M = 2.5 ms / 2 us = 1250

Timer Code #define PERIOD 1250 void TOC2open(void); // function prototype // initialization part of main TSCR1 = 0x80; // initialize the main Timer TSCR2 = 0x04; // prescale set to divide by 16 TOC2open(); // initialize Output Compare

Timer Channel Initialization // output compare initialization for channel 2 void TOC2open(void) { TIOS |= 0x04; // output compare mode TCTL1 = 0; TCTL2 = 0x10; // toggle PTT.2 TIE |= 0x04; // enable interrupts TFLG1 = 0x04; // clear event TC2 = TCNT + PERIOD; }