7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ 85287 Dr. Yann-Hang Lee (480)

Slides:



Advertisements
Similar presentations
Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati I/O + Timer 8155 I/O + Timer 8255 I/O 8255 I/O 8253/54 Timer 8253/54 Timer 2 Port (A,B), No Bidirectional.
Advertisements

More fun with Timer/Counters
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Microcontroller Programming II MP6-1
Programmable Interval Timer
8253/54 Timer Section /54 Timer Description and Initialization
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 
8254 Modes Made by: Ryan wahab (8) Modes Gate is low the count will be paused Gate is high Will continue counting Mode 0: An events counter.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
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”
Timer Interface Module MTT TIMER INTERFACE MODULE (TIM)
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.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Module Introduction Purpose  This training module provides an overview of the different.
8254 Programmable Interval Timer
ENEE 440 Chapter Timer 8254 Register Select The 8254 timer is actually 3 timers in one. It is an upgraded version of the 8253 timer which was.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
8253 TIMER. Engr 4862 Microprocessors 8253 / 8254 Timer A.k.a. PIT (programmable Interval Timer), used to bring down the frequency to the desired level.
PIT: Programmable Interval Timer
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
Timer/counter Chapter 12
ARM Timers.
System Clocks.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Chapter 4 TIMER OPERATION
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
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.
Timer Peripherals.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
1 ARM University Program Copyright © ARM Ltd 2013 Timer Peripherals.
7/23 Interrupt Controller and Edge Port in Coldfire Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
Timer Timer is a device, which counts the input at regular interval (δT) using clock pulses at its input. The counts increment on each pulse and store.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
1 ARM University Program Copyright © ARM Ltd 2013 Using Direct Memory Access to Improve Performance.
8254 Timer.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
C Examples 6. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
Seth Schwiethale James Crosetto James Ellison.  square pulse of ms, repeats every 20 ms  It is the same for both steering and acceleration 
Why are Timer Functions Important?
V.V.P. ENGINEERING COLLEGE,RAJKOT
ECE 3430 – Intro to Microcomputer Systems
Timer and Interrupts.
Programmable Interval Timer
Programmable Interval Timer
Programmable Interval Timer 8254 LECTURE 3
AVR Addressing Modes Subject: Microcontoller & Interfacing
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.
Introduction to Micro Controllers & Embedded System Design Timer Operation Department of Electrical & Computer Engineering Missouri University of Science.
8254 Timer and Counter (8254 IC).
Timer.
Programmable Interval timer 8253 / 8254
8-bit Timer/Counter2 with PWM and Asynchronous Operation
Programmable Interval timer 8253 / 8254
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
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.
Wireless Embedded Systems
Programmable Interval Timer
Presentation transcript:

7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)

set General Purpose Timer  The basic unit – counter (up or down)  a clock source  generate timing events (interrupts or timer output)  if overflow or reach 0  if match with a preset value  measure time – read counter values (captured)  free running, reset or reload, compare binary counter clock (external or internal) control circuit

set Measurement  Input-capture : identify the moment that an event occurs  latch the counter value when triggered  CPU can read the value later  Output compare : control the timing of output bit  CPU sets a value in output compare register  compare with counter every clock cycle  if equal, send an output signal  External event counting  Measuring elapsed time, pulse width, frequency, and period binary counter input capture register clock load interrupt or ready flag event edge detection

set Hardware Timer  Typical approach –  hardware unit generates an interrupt per unit of time (e.g. millisecond)  Avoid overflow with a software counter (in memory) – incremented when interrupts  assume the input clock of 2MHz (0.5x10 -3 ms)  set a compare counter to 1999  start counting with the input clock and, when equals to the compare register  interrupt  restart the counter from 0 binary counter = compare register (1999) input clock (2MHz) restart interrupt or toggle output

Delay Function using DMA Timer  Initialize a timer and input frequency  Set up a compare value  Check for flag or wait for interrupt set

DMA Timer  Control and status registers  mode register: #define MCF_DTIM3_DTMR *(vuint16*)(&__IPSBAR[0x0004C0]))  extended mode register  event register  reference register: for comparison  capture register: save counter value on capture event  counter register: counting set

Fucntion cpu_pause void cpu_pause_m(int usecs) { /* Enable the DMA Timer 3 */ MCF_DTIM3_DTRR = (usecs - 1); MCF_DTIM3_DTER = MCF_DTIM_DTER_REF;// 0x02 MCF_DTIM3_DTMR = 0 | MCF_DTIM_DTMR_PS(sys_clk_khz / 1000) | MCF_DTIM_DTMR_ORRI// 0x0010 | MCF_DTIM_DTMR_FRR// 0x0008 | MCF_DTIM_DTMR_CLK_DIV1// 0x0002 | MCF_DTIM_DTMR_RST;// 0x0001 while ((MCF_DTIM3_DTER & MCF_DTIM_DTER_REF) == 0) {}; /* Disable the timer */ MCF_DTIM3_DTMR = 0; } set

set Pulse Width Measurement  Capture counter values on edges  Read the difference to know the width  (count2-count1)/(timer frequency)  If the pulse is much longer, counter may overflow  interrupts on overflows  use software counter to count number of overflows. capture count1 capture count2

set Waveform Generator  Duty cycle : (pulse duration)/(clock period)  50% -- square wave  Free-running or reset on compare event  Use DMA timer to generate a square wave of 1KHz based on an input clock is 40MHz—  Pin assignment of DMA timer 0  Toggle output every 500  s  Mode register: CE, OM, ORPI, FRR, CLK, RST  Reference register: DTRR  500  s = 1/40MHz * (prescale+1) * (DTRR+1)

PWM in 5211  4 PWM outputs  8 channels  Counter (8 bits)  Period/duty  Even+odd channels  16 bit pwm  4 clock sources  A, SA, B, SB set

PWM in 5211  Initialization MCF_GPIO_PTAPAR = 0 | MCF_GPIO_PTAPAR_PTAPAR0(3); MCF_PWM_PWMPOL = 0 | MCF_PWM_PWMPOL_PPOL1; MCF_PWM_PWMCLK = 0|MCF_PWM_PWMCLK_PCLK1; MCF_PWM_PWMPRCLK = PRE_SCALE; MCF_PWM_PWMSCLA = SCALE; MCF_PWM_PWMPER1 = 255;  Set duty cycle MCF_PWM_PWMDTY(channel) = duty_cycle;  Enable pwm MCF_PWM_PWME = 0|MCF_PWM_PWME_PWME1 set