Presentation is loading. Please wait.

Presentation is loading. Please wait.

Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.

Similar presentations


Presentation on theme: "Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts."— Presentation transcript:

1 Timers in Hardware ECE152

2 Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts

3 Possible Timers Timer0 (8 Bit) Timer1 (16 bit) Timer2 (8 Bit) - Real Time Clock Timer3 (16 Bit)

4 Timer0 Important Registers TCCR0A – Timer Counter Control A TCCR0B – Timer Counter Control B TCNT0- Timer Count OCR0A – Output Compare Register A

5 Timer0 Modes In general we use Clear Timer Counter (CTC) mode

6 Clock Source Based on CLK IO (1 MHz) In groups, calculate the maximum and minimum time the can be counted for each selection.

7 Example Simple Timer0 Lets walk through the configuration registers and make a simple program to blink some LEDs

8 Things to Remember To use a piece of hardware in a microcontroller: – Read the data sheet – Go though the registers one by one and decide on bit values When in doubt, set to default


Download ppt "Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts."

Similar presentations


Ads by Google