ATtiny2313 Timers/Counters CS-423 Dick Steflik. What Do You Use Timers For? Timing of events (internal or external)‏ Scheduling Events Measuring the width.

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
3 Phase Wave Generation 3 Phase waveform generation using Timer/Counter1 and 3 on atmega128.
Introduction of Holtek HT-46 series MCU
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.
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.
Pulse Width Modulation modes
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
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.
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.
System Clocks.
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.
Timer Peripherals.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
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.
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.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
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 Scheduled Interrupts
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
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.
Timer 1 and 2 operation, PWM Principles. Timer 1 Operation.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
16-Bit Timer/Counter 1 and 3
Why are Timer Functions Important?
MICROCONTROLLER AND INTERFACING
Application Case Study Security Camera Controller
V.V.P. ENGINEERING COLLEGE,RAJKOT
PWM and DC Motor Control
BITS EDU. CAMPUS , VARNAMA
AVR Addressing Modes Subject: Microcontoller & Interfacing
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.
16-bit Timer/Counter1 Features
8-bit Timer/Counter0 with PWM
ECE 3430 – Intro to Microcomputer Systems
ATmega103 Timer0 and Interrupts
8051 Timers Prof. Rajiv R Bhandari.
PWM and DC Motor Control
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
Signals from ucc28c42 current mode example: these show basic conflict of getting correct PWM if buffered ramp is applied at CS pin: If peak of the buffered.
DC motor and PWM.
8-bit Timer/Counter2 with PWM and Asynchronous Operation
UNIT 19 PWM 로봇 SW 교육원 조용수.
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
Timers/Counters.
Wave Generation and Input Capturing
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
Presentation transcript:

ATtiny2313 Timers/Counters CS-423 Dick Steflik

What Do You Use Timers For? Timing of events (internal or external)‏ Scheduling Events Measuring the width of a pulse Speed control of motors (PWM)‏ Generation of complex waveforms Frequency generation (sounds)‏

The concept of using a timer/counter Counters run asynchronously to your code Can be setup to start based on an internal or external event Can generate interrupts Can signal to a pin

Example To time a piece of code:  Initial the counter to 0, have it interrupt on overflow  Interrupt handler should count overflows  Start the counter  Run your code  At end of code read counter and add to number of overflows to get total time

Example To time an incoming pulse/event:  Setup interrupts on rising and falling edge of pulse and overflow of counter  In handler for rising edge start counter  In handler for overflow, count the overflows  In handler for falling edge read counter and add overflows to get time of pulse/event

Example Motor control:  Use counter to generate a pulse train to control speed of DC motors Full speed = full power (infinitely wide pulse Low speed = narrow pulses with wide down time 50% speed = equal up and down times  Can only control very small motoers directly, must use high power transistors to drive bigger motors This is came idea as intermittent wipers on a car

2 Timer/Counter Units 8-bit Timer/Counter0 w/PWM 16-bit Timer/Counter1 Timer/Counter1 and Timer/Counter0 prescalers

8-bit Timer/Counter0 Single channel counter Frequency Generator External Event Counter 10-bit clock prescaler  Only used with internal clock  Scale by: 1, 8, 64, 256, 1024

8-bit Timer/Counter0

Sample code can be found at: gcc.html

16-bit Timer/Counter1

Modes of Operation Normal Mode – always counts up, no clear, counter just overruns Clear Timer on Compare match (CTC mode)‏ Fast PWM Mode Phase Correct PWM mode Phase and Frequence Correct PWM mode

16-bit Timer/Counter1 Sample code can be found at: winavr.html

Prescaler