SlideShare a Scribd company logo
1 of 14
Download to read offline
TIMER
Name: Vedansh Sharma
Roll No. : 15uec069
Types of Timers:
1. TC0 8-bit Timer/Counter0
2. TC1 16-bit Timer/Counters 1
3. TC2 8-bit Timer/Counter2
TC0
Timer/Counter0 (TC0) is a general purpose 8-bit Timer/Counter module.
Would have a range of 0 - 255.
It allows program execution timing (event management) and wave generation.
TC1
Timer/Counter1 (TC1) is a general purpose 16-bit Timer/Counter module.
Range from 0 - 65536
It allows accurate program execution timing (event management), wave
generation, and signal timing measurement.
TC2
Timer/Counter2 (TC2) is a general purpose, channel, 8-bit Timer/Counter module.
The Timer/Counter can be clocked internally, via the prescaler, or asynchronously
clocked from the TOSC1/2 pins.
Allows Clocking from External 32kHz Watch Crystal Independent of the I/O Clock
Counter Unit Block Diagram
Internal signals used in Counter unit
Signal Name Description
count Increment or decrement TCNT0 by 1.
direction Select between increment and decrement.
clear Clear TCNT0 (set all bits to zero).
clkTn
Timer/Counter clock, referred to as clkT0
in the
following.
top Signalize that TCNT0 has reached maximum
value.
bottom Signalize that TCNT0 has reached minimum
value (zero).
Depending of the
mode of operation
used, the counter
is cleared,
incremented, or
decremented at
each timer clock
(clkT0
).
Why Mode of Operation?
How the counter behaves (counts) and how waveforms are generated on the
Output Compare outputs OC0A and OC0B
.The counting sequence is determined.
How the Timer/Counter Overflow Flag (TOV0) is set
Modes of Operation
The mode of operation determines the behavior of the Timer/Counter and the
Output Compare pins
Mode is defined by the combination of the Waveform Generation mode bits and
Compare Output mode.
Waveform Generation mode affects the counting.
Action to be performed
Inverted
PWM
PWM
Output
Compare
Mode
Non-PWM
Output set
Output
Cleared
Non-Inverted
PWM
Output
toggled
Normal Mode
In this mode the counting direction is always up (incrementing), and no counter
clear is performed.
Timer/Counter Overflow Flag (TOV1) will be set in the same clock cycle in which
the TCNT1 becomes zero. the TOV1 Flag behaves like a ninth bit.
For TC0
Clear Timer on Compare Match (CTC) Mode
The counter is cleared to ZERO when the counter value (TCNT0) matches the
OCR0A.
Timer/Counter
Overflow Flag
is set in the
same clock
cycle that the
counter wraps
from MAX to
0x00.
Fast PWM Mode
It provide a high frequency PWM waveform generation option.Differ by their
single-slope operation.The counter counts from BOTTOM to TOP, then restarts
from BOTTOM.
Phase Correct PWM Mode
The Phase Correct PWM mode provides a high resolution, phase correct PWM
waveform generation. The Phase Correct PWM mode is based on dual-slope
operation. The counter counts repeatedly from BOTTOM to TOP, and then from
TOP to BOTTOM.

More Related Content

What's hot

Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacingdeval patel
 
PIC timer programming
PIC timer programmingPIC timer programming
PIC timer programmingAkash Puri
 
Telecommunication switching system
Telecommunication switching systemTelecommunication switching system
Telecommunication switching systemMadhumita Tamhane
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Sadiq Rahim
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanismVijay Kumar
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and CountersShreyans Pathak
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers ViVek Patel
 
8086 modes
8086 modes8086 modes
8086 modesPDFSHARE
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051SARITHA REDDY
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarGauravRaikar3
 
ARM 7 Detailed instruction set
ARM 7 Detailed instruction setARM 7 Detailed instruction set
ARM 7 Detailed instruction setP.r. Dinesh
 
8051 microcontroller features
8051 microcontroller features8051 microcontroller features
8051 microcontroller featuresTech_MX
 

What's hot (20)

Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
 
Lpc 1768 timers
Lpc 1768 timersLpc 1768 timers
Lpc 1768 timers
 
STM32 MCU Family
STM32 MCU FamilySTM32 MCU Family
STM32 MCU Family
 
PIC timer programming
PIC timer programmingPIC timer programming
PIC timer programming
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
 
Telecommunication switching system
Telecommunication switching systemTelecommunication switching system
Telecommunication switching system
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Interrupts
InterruptsInterrupts
Interrupts
 
Memory interfacing of microcontroller 8051
Memory interfacing of microcontroller 8051Memory interfacing of microcontroller 8051
Memory interfacing of microcontroller 8051
 
SRAM DRAM
SRAM DRAMSRAM DRAM
SRAM DRAM
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanism
 
8051 Timers and Counters
8051 Timers and Counters8051 Timers and Counters
8051 Timers and Counters
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers
 
8086 modes
8086 modes8086 modes
8086 modes
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Directional couplers 22
Directional couplers 22Directional couplers 22
Directional couplers 22
 
SPI.ppt
SPI.pptSPI.ppt
SPI.ppt
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
ARM 7 Detailed instruction set
ARM 7 Detailed instruction setARM 7 Detailed instruction set
ARM 7 Detailed instruction set
 
8051 microcontroller features
8051 microcontroller features8051 microcontroller features
8051 microcontroller features
 

Similar to Timers in Arduino (20)

timer counter (1).pptx
timer counter (1).pptxtimer counter (1).pptx
timer counter (1).pptx
 
AVRTIMER.pptx
AVRTIMER.pptxAVRTIMER.pptx
AVRTIMER.pptx
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
 
Timers
TimersTimers
Timers
 
Timers
TimersTimers
Timers
 
8051 ch9
8051 ch98051 ch9
8051 ch9
 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
8051 timers--2
   8051 timers--2   8051 timers--2
8051 timers--2
 
L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 p
 
8051 ch9-950217
8051 ch9-9502178051 ch9-950217
8051 ch9-950217
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
 
9 timer programming
9 timer programming9 timer programming
9 timer programming
 
Timers of 8051
Timers of 8051Timers of 8051
Timers of 8051
 
Microprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterMicroprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and Counter
 
UNIT-5.ppt
UNIT-5.pptUNIT-5.ppt
UNIT-5.ppt
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
4.Timer_1.ppt
4.Timer_1.ppt4.Timer_1.ppt
4.Timer_1.ppt
 
Timers
TimersTimers
Timers
 

Recently uploaded

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 

Recently uploaded (20)

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 

Timers in Arduino

  • 2. Types of Timers: 1. TC0 8-bit Timer/Counter0 2. TC1 16-bit Timer/Counters 1 3. TC2 8-bit Timer/Counter2
  • 3. TC0 Timer/Counter0 (TC0) is a general purpose 8-bit Timer/Counter module. Would have a range of 0 - 255. It allows program execution timing (event management) and wave generation.
  • 4. TC1 Timer/Counter1 (TC1) is a general purpose 16-bit Timer/Counter module. Range from 0 - 65536 It allows accurate program execution timing (event management), wave generation, and signal timing measurement.
  • 5. TC2 Timer/Counter2 (TC2) is a general purpose, channel, 8-bit Timer/Counter module. The Timer/Counter can be clocked internally, via the prescaler, or asynchronously clocked from the TOSC1/2 pins. Allows Clocking from External 32kHz Watch Crystal Independent of the I/O Clock
  • 7. Internal signals used in Counter unit Signal Name Description count Increment or decrement TCNT0 by 1. direction Select between increment and decrement. clear Clear TCNT0 (set all bits to zero). clkTn Timer/Counter clock, referred to as clkT0 in the following. top Signalize that TCNT0 has reached maximum value. bottom Signalize that TCNT0 has reached minimum value (zero). Depending of the mode of operation used, the counter is cleared, incremented, or decremented at each timer clock (clkT0 ).
  • 8. Why Mode of Operation? How the counter behaves (counts) and how waveforms are generated on the Output Compare outputs OC0A and OC0B .The counting sequence is determined. How the Timer/Counter Overflow Flag (TOV0) is set
  • 9. Modes of Operation The mode of operation determines the behavior of the Timer/Counter and the Output Compare pins Mode is defined by the combination of the Waveform Generation mode bits and Compare Output mode. Waveform Generation mode affects the counting.
  • 10. Action to be performed Inverted PWM PWM Output Compare Mode Non-PWM Output set Output Cleared Non-Inverted PWM Output toggled
  • 11. Normal Mode In this mode the counting direction is always up (incrementing), and no counter clear is performed. Timer/Counter Overflow Flag (TOV1) will be set in the same clock cycle in which the TCNT1 becomes zero. the TOV1 Flag behaves like a ninth bit. For TC0
  • 12. Clear Timer on Compare Match (CTC) Mode The counter is cleared to ZERO when the counter value (TCNT0) matches the OCR0A. Timer/Counter Overflow Flag is set in the same clock cycle that the counter wraps from MAX to 0x00.
  • 13. Fast PWM Mode It provide a high frequency PWM waveform generation option.Differ by their single-slope operation.The counter counts from BOTTOM to TOP, then restarts from BOTTOM.
  • 14. Phase Correct PWM Mode The Phase Correct PWM mode provides a high resolution, phase correct PWM waveform generation. The Phase Correct PWM mode is based on dual-slope operation. The counter counts repeatedly from BOTTOM to TOP, and then from TOP to BOTTOM.