Pulse Width Modulation modes

Slides:



Advertisements
Similar presentations
More fun with Timer/Counters
Advertisements

Microcontroller Programming II MP6-1
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.
Analog/Digital Subsystem
Introduction of Holtek HT-46 series MCU
COMP3221: Microprocessors and Embedded Systems Lecture 16: Interrupts II Lecturer: Hui Wu Session 2, 2005.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
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.
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 
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
The Use of Microcontrollers
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.
Software Three Main Functions Records/Monitors Zero Detection Points Gives our PWM a starting point Data used to dynamically adjust carrier frequency Detects.
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)
Slides created by: Professor Ian G. Harris Interrupts  Embedded systems often perform some tasks which are infrequent and possibly unpredictable Hang.
Timer/counter Chapter 12
ARM Timers.
A Few Words From Dilbert
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.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
1 Lab 5: Controls and feedback. 2 Lab 5: Control and Feedback This embedded system uses the Photo sensor to detect the light intensity of the environment.
Advanced uC Session Speaker : Chiraag Juvekar Jan 13, 2011 Speaker : Chiraag Juvekar Jan 13, 2011.
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
Counter/Timer/PWM. incoming Lab. Counter counter is a device which stores the number of times a particular event or process has occurred synchronous/asynchronous.
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.
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)
CS-280 Dr. Mark L. Hornick 1 Atmel Timer/Counter System Most microcontrollers include some type of timer system Facilitates real-time monitoring and control.
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.
Timers and Interrupts Mark Neil - Microprocessor Course.
Timers and Scheduled Interrupts
June 9, s Massachusetts Institute of Technology 6.11s: Design of Motors, Generators and Drive Systems Switching Patterns and Simple Implementation.
The AVR microcontroller and embedded systems using assembly and c AVR Microcontroller and Embedded System Using Assembly and C Mazidi, Naimi, and Naimi.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
Timer 1 and 2 operation, PWM Principles. Timer 1 Operation.
C Examples 6. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
Seth Schwiethale James Crosetto James Ellison.  square pulse of ms, repeats every 20 ms  It is the same for both steering and acceleration 
INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR.
16-Bit Timer/Counter 1 and 3
Timers and Scheduled Interrupts
Why are Timer Functions Important?
V.V.P. ENGINEERING COLLEGE,RAJKOT
ECE 3430 – Intro to Microcomputer Systems
BITS EDU. CAMPUS , VARNAMA
AVR Addressing Modes Subject: Microcontoller & Interfacing
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
UNIT 5 TIMRERS/COUNTERS
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.
16-bit Timer/Counter1 Features
8-bit Timer/Counter0 with PWM
ATmega103 Timer0 and Interrupts
DC motor and PWM.
8-bit Timer/Counter2 with PWM and Asynchronous Operation
Timers/Counters.
Wave Generation and Input Capturing
Polling vs. Interrupts CS2852 4/9/2019
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Pulse Width Modulation modes Timer/Counter Pulse Width Modulation modes CS-280 Dr. Mark L. Hornick

There are two PWM modes of Timer/Counter 0 PWM mode is determined by bits WGM00:WGM01 1:1 – Fast PWM mode Timer/Counter counts from 0x00 to 0xFF After reaching 0xFF, rolls over to 0x00 and starts over 1:0 – Phase Correct PWM mode Timer/Counter counts from 0x00 to 0xFF to 0x00 After reaching 0xFF, decrements back down to 0x00 and starts over CS-280 Dr. Mark L. Hornick

In both PWM modes, the T/C counts all the way to MAX Counter value MAX= 0xFF OCR0 BOTTOM = 0x00 Fast PWM Mode ticks Counter value MAX= 0xFF OCR0 BOTTOM = 0x00 PWM Phase Correct Mode ticks CS-280 Dr. Mark L. Hornick

Output Comparator behavior in PWM Modes Output Comparator can drive the voltage on OC0 (PB3) high or low PB3 must be setup for output When in PWM modes, bits COM01:COM00 affect the operation as follows: 0 0: OC0 disconnected 0 1: Reserved 1 0: Clear OC0 on compare match 1 1: Set OC0 on compare match CS-280 Dr. Mark L. Hornick

Signals on OC0 in Fast PWM mode Counter value MAX= 0xFF OCR0 BOTTOM = 0x00 Fast PWM Mode ticks COM01:COM00 = 1:1 Set OC0 on compare match COM01:COM00 = 1:0 Clear OC0 on compare match ticks Signal on OC0 CS-280 Dr. Mark L. Hornick

Fast PWM Interrupts OCF0 flag in TIFR is set when TCNT0=OCR0. When OCIE0 is enabled: Compare Match interrupt is generated (ISR jump vector at 0x14) OCF0 is automatically reset when ISR is executed TOV0 is set when TCNT0 overflows from 0xFF to 0. When TOIE0 is enabled: Overflow interrupt is generated (ISR jump vector at 0x16) TOV0 is automatically reset when ISR is executed CS-280 Dr. Mark L. Hornick

The duration of pulse width can be modulated by varying the value of OCR0 CS-280 Dr. Mark L. Hornick

Behavior of OC0 in PWM Phase Correct mode Counter value MAX= 0xFF OCR0 BOTTOM = 0x00 PWM Phase Correct Mode ticks COM01:COM00 = 1:1 Set OC0 on compare match COM01:COM00 = 1:0 Clear OC0 on compare match ticks Signal on OC0 CS-280 Dr. Mark L. Hornick

Phase-correct Interrupts OCF0 flag in TIFR is set when TCNT0=OCR0. When OCIE0 is enabled: Compare Match interrupt is generated (ISR jump vector at 0x14) OCF0 is automatically reset when ISR is executed TOV0 is set when TCNT0 decrements back to 0. When TOIE0 is enabled: Overflow interrupt is generated (ISR jump vector at 0x16) TOV0 is automatically reset when ISR is executed CS-280 Dr. Mark L. Hornick

Pulse width modulation in Phase-correct operation CS-280 Dr. Mark L. Hornick