MS_uC / fue1 / V01 6- 1 TIMx - Timer Programming Microcontroller TIMx - Timer Autumn term 2012.

Slides:



Advertisements
Similar presentations
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 5 Other Subsystems.
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
Sistemi Elettronici Programmabili13-1 MULTI OSC + CLOCK FILTER LVD POWER SUPPLY CONTROL 8 BIT CORE ALU PROGRAM MEMORY RAM I2CI2C PORT A SPI PORT B 16-BIT.
Introduction of Holtek HT-46 series MCU
MS_uC / dnd / V TIM - Timer Programming Microcontroller TIM - Timer Autumn term K Byte Burst Flash 64K or 96K Byte SRAM 256K or 512K Byte.
ATtiny2313 Timers/Counters CS-423 Dick Steflik. What Do You Use Timers For? Timing of events (internal or external)‏ Scheduling Events Measuring the width.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
MS_uC / dnd / V VIC - Vectored Interrupts Programming Microcontroller VIC – Vectored interrupt controller Autumn term K Byte Burst Flash.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
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.
ENG3640 Microcomputer Interfacing Week #6 Timing Generation and Measurement.
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)
Lecture 29: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM)
ARM Timers.
System Clocks.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
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.
Event Manager Block Diagram (EVA)
Timer Peripherals.
AT91 Embedded Peripherals
1 ARM University Program Copyright © ARM Ltd 2013 Timer Peripherals.
ECE 447 Fall 2009 Lecture 10: TI MSP430 Timers and Capture Modes.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
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.
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This course provides an overview of the standard peripheral.
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM) Refer to Chapter 21 in the reference book “Stellaris® LM3S9B96 Microcontroller.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
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.
16F877A.
Why are Timer Functions Important?
Lecture 10: TI MSP430 Timers and Capture Modes
Timers and Event Counters
V.V.P. ENGINEERING COLLEGE,RAJKOT
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
PWM and DC Motor Control
EI205 Lecture 8 Dianguang Ma Fall 2008.
Timer and Interrupts.
Programmable Interval Timer
AVR Addressing Modes Subject: Microcontoller & Interfacing
MSP432 ARM Timer Programming
RX Compare Match Timer (CMT)
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Timer/Counter Modified from Dr. Lam Phung’s Slides.
8-bit Timer/Counter0 with PWM
8051 Timers Prof. Rajiv R Bhandari.
8254 Timer and Counter (8254 IC).
Programmable Interval timer 8253 / 8254
STM Arm Timer Programming
Programmable Interval timer 8253 / 8254
UNIT 19 PWM 로봇 SW 교육원 조용수.
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.
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
Presentation transcript:

MS_uC / fue1 / V TIMx - Timer Programming Microcontroller TIMx - Timer Autumn term 2012

MS_uC / fue1 / V TIMx - Timer Typical Timer Features zFour 16 bit Timers, support: yTwo Input Captures yTwo Output Compares yPWM Out yPWM Input yOne Pulse Mode zTwo Clocks: External clocks, Internal Events zPrescaler zDMA support ® Input Cap 2 Peripheral Bus TIMx_ETR Interrupt - Overflow, OCMP, ICAP 16 Bit Prescaler CK_INT Overflow Output Comp. 1 Output Comp. 2 Output Comp. Reg 2 Latch 2 IC1 IC2 OC1 OC2 Control Registers Trigger controller Input Cap 1 16-Bit Counter Register Output Comp. Reg 1 ITR0 ITR3 Latch 2 Edge Detect Circuit 2 Edge Detect Circuit 1

MS_uC / fue1 / V01 STM32F107xx Timer Modules RM0008 Reference manual zAdvanced-control timers: TIM1 & TIM8 y16-bit up, down, up/down auto-reloat counter y4 Indepent channels xInput capture, Output compare, PWM & OPM yComplementary outputs with programmable dead time zGeneral-purpose timers (TIM2 to TIM5) y16-bit up, down, up/down auto-reloat counter y4 Indepent channels zGeneral-purpose timers (TIM9 to TIM14) y16-bit up, down, up/down auto-reloat counter y2 Indepent channels zBasic Timers (TIM6 & TIM7) y16-bit up, down, up/down auto-reloat counter 6- 3 TIM - Timer

MS_uC / fue1 / V TIM - Timer General-purpose timers main features (1/2) z16-bit up, down, up/down auto reload counter yProvide counter values for output compare and input capture z16-bit programmable pre scaler used to divide the counter clock frequency by any factor between 1 and 65’535 zUp to 4 independent channels for: yInput capture yOutput compare yPWM generation yOne pulse mode output zSynchronization circuit to control the timer with external signals and to interconnect several timers ®

MS_uC / fue1 / V01 General-purpose timers main features (2/2) zInterrupt/DMA generation on the following events yUpdate: counter overflow/underflow, counter initialization (by software or internal/external trigger) yTrigger event (counter start, stop, initialization or count by internal/external trigger) yInput capture yOutput compare zSupports incremental (quadrature) encode and hall-sensor circuitry for positioning purposes zTrigger input for external clock or cycle-by cycle current management 6- 5 TIM - Timer

MS_uC / fue1 / V TIM - Timer TIMx modes of functionality zInput Capture Mode yTwo input pins, user programmable edge polarity yCapture counter values when input edge is detected yGenerate interrupt when enabled yCan measure input pulse width zOutput Compare Mode yTwo output compare pins, one for each compare register yCompare Register is compared with counter value yGenerate output signal/waveform on pin when a match occurred yUser programmable output signal level zOther Timer Modes yBased on the Input Capture and Output Compare logic xOne Pulse Mode xPWM Output Mode xPWM Input Mode ®

MS_uC / fue1 / V TIM - Timer TIMx PWM output mode zAutomatic generation of a Pulse Width Modulated signal yFrequency determined by TIMx_ARR register yDuty cycle corresponds to TIMx_CCRx register zConfiguration for the PWM output mode zOCxM bits in the TIMx_CCMRx register selects the PWM output mode for OCx zOCxPE bit in the TIM_CCMRx register enables the corresponding preload register zARPE bit in the TIMCR1 register enables auto-reload preload register zCCxP bit in the TIM_CCER register defines the polarity of the OCx output zCCxE bit in the TIM_CCER register enable the OCx output zThe duty cycle is stored in TIMx_CCR1 register zThe full period is stored in TIMx_ARR register TIMx_CCR1 = 0x2ED0 TIMx_ARR = 0x34E2 CC1P = 0 OLVL E2 2ED02ED1…0000 Counter OC1 CC1P = 0 Compare 1Compare 2 34E2 Compare 2 34E22ED0 ®

MS_uC / fue1 / V TIM - Timer TIMx PWM input mode zExternal pulse and period measurement of an external wave yProgrammable first edge detection yInterrupt Generation zConfiguration for the PWM input mode zCC1S bits of TIMx_CCMR1 register select the input for TIMx_CCR1 (TI1) zCC1P bit of TIMx_CCER register selects the active polarity of TI1 (rising edge) zCC2S bits of TIMx_CCMR2 register select the input for TIMx_CCR2 (TI1) zCC2P bit of TIMx_CCER register selects the active polarity of TI1 (falling edge) zTS bits of TIMx_SMCR register select TI1FP1 as trigger for the slave controller zSMS bits of TIMx_SMCR register configure the slave controller in reset mode zCC1E and CCE2 bits of the TIMx_CCER register enable the captures Period = TIMx_CCR2 Pulse Length = TIMx_CCR E2 2ED02ED1…0000 Counter TI1 IC2 captureIC1 capture 34E2 IC1 capture TIMx_CCR1 = 0x2ED0 TIMx_CCR2 = 0x34E2 CC1S = 0b01 CC2S = 0b10 CC1P = 0 CC2P = 1

MS_uC / fue1 / V01 TIMx one pulse mode 6- 9 TIMx - Timer zGeneration of a pulse synchronized with an external event zParticular case of the previous modes zStarting the controller can be controlled by the slave mode controller zGeneration the waveform can be done in output compare mode TIMx_CCR1 = 0x2ED0 TIMx_ARR = 0x2ED3 CC1P = 0 CC1P = 1 FFFC … 2ED02ED1 2ED2 2ED30000 Counter TI2 OC1 CC1P = 1 Compare ED0 zConfiguration for the one pulse mode zOPM bit of TIMx_CR1 register selects one pulse mode zIC2S bits of TIMx_CCMR1 register maps TI2FP2 on TI2 zCC2P bits of TIMx_SMCR register select the rising edge detection for TI2FP2 zTS bits of TIMx_SMCR register configure TI2FP2 as trigger for the slave mode controller zSMS bits of TIMx_SMCR register enable TI2FP2 signal to start the counter zTIMx_CCR1 register defines the passive period zTIMx_ARR – TIMx_CCR1 defines the active period zCC1P bit of TIMxCCMR1 register fix the polarity of the active signal ®

MS_uC / fue1 / V TIM - Timer General purpose timer block diagram

MS_uC / fue1 / V TIM - Timer Presaler zThe prescaler can divide the counter clock frequency by any factor between 1 & zItis based on a 16-bit counter controlled through a 16-bit register (TIMx_PSC register)

MS_uC / fue1 / V TIM - Timer Timer Register Map (1/3) RM0008 Reference manual (page 407)

MS_uC / fue1 / V TIM - Timer Timer Register Map (2/3)

MS_uC / fue1 / V01 Timer Register Map (3/3) TIM - Timer

MS_uC / fue1 / V TIM - Timer ARM Peripheral Bus 2 access (APB2) RM0008 Reference manual (page 51)

MS_uC / fue1 / V TIM - Timer ARM Peripheral Bus 1 access (APB0)