0% found this document useful (0 votes)
12 views2 pages

Ch09 AVR Timer Programming

The document is an ATmega328 Timer Calculator that allows users to input specific values for crystal frequency, desired delay, frequency to generate, and duty cycle. It provides calculations for timer settings in both CTC and Normal modes, detailing the timer clock, time period, total counts, and output compare register values. The document is designed by Engr. Rashid Farid Chishti from the International Islamic University Islamabad.

Uploaded by

xirer50826
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Ch09 AVR Timer Programming

The document is an ATmega328 Timer Calculator that allows users to input specific values for crystal frequency, desired delay, frequency to generate, and duty cycle. It provides calculations for timer settings in both CTC and Normal modes, detailing the timer clock, time period, total counts, and output compare register values. The document is designed by Engr. Rashid Farid Chishti from the International Islamic University Islamabad.

Uploaded by

xirer50826
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd

ATmega328 Timer Calculator (Change the values written in RED )

Crystal Frequency (XTAL) = 16,000,000 Hz 16000 KHz 16 MHz For Desired Delay = 1000 m sec
Frequency you want to generate = 0.5 Hz 0.0005 KHz 0.0000005 MHz .← ← ← Put Frequency = 0.5 Hz
So Its time period is 2 sec 2000 msec 2000000 usec
Duty Cycle you want to generate = 50 Percent

Delay for Output pin to remain HIGH = 1 sec 1000 msec 1000000 usec

Max Delay for Timer0 and Timer2 0.016384 sec 16.384 msec 16384 usec
Max Delay for Timer1 4.194304 sec 4194.3 msec 4194304 usec

Using CTC Mode Using Normal Mode


Scalar Timer Clock Time Period Total Counts OCR0A OR OCR2A OCR1A (16-bit) TCNT0 OR TCNT2 (8-bit) TCNT1 (16-bit)
none 16 MHz 0.0625 usec 16,000,000 15,999,999.00 F423FF 15,999,999.00 F423FF -15,999,744.00 FFFF0BDD00 -15,934,464.00 FFFF0CDC00
8 2 MHz 0.5 usec 2,000,000 1,999,999.00 1E847F 1,999,999.00 1E847F -1,999,744.00 FFFFE17C80 -1,934,464.00 FFFFE27B80
Timer2 32 500 KHz 2 usec 500,000 499,999.00 7A11F 499,999.00 7A11F -499,744.00 FFFFF85FE0 -434,464.00 FFFFF95EE0
64 250 KHz 4 usec 250,000 249,999.00 3D08F 249,999.00 3D08F -249,744.00 FFFFFC3070 -184,464.00 FFFFFD2F70
Timer2 128 125 KHz 8 usec 125,000 124,999.00 1E847 124,999.00 1E847 -124,744.00 FFFFFE18B8 -59,464.00 FFFFFF17B8
256 62.5 KHz 16 usec 62,500 62,499.00 F423 62,499.00 F423 -62,244.00 FFFFFF0CDC 3,036.00 BDC
1024 15.625 KHz 64 usec 15,625 15,624.00 3D08 15,624.00 3D08 -15,369.00 FFFFFFC3F7 49,911.00 C2F7

Designed by: Engr. Rashid Farid Chishti, Lecturer, DEE, FET. International Islamic University Islamabad

You might also like