what crystal oscillator should i use??

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Hey all, i am trying to build a digital stop watch with TAmega168. So I am wondering what crystal oscillator should i be using? :confused: I know that a 16MHz will not work, because it doesn't divide even to one second.

Thanks in advance!!
 

nanovate

Joined May 7, 2007
666
Use the 16-bit timer and the prescaler on the mega168 to get your 1Hz signal while using a crystal that divides evenly by the prescaler:
4, 8, and 16 MHz all work. The 32.768 kHz crystal also works with the 8-bit T0 or T2

Also use the CTC or PWM modes so the mega168 auto-reloads the timer.
 

Thread Starter

Sonoma_Dog

Joined Jul 24, 2008
99
Use the 16-bit timer and the prescaler on the mega168 to get your 1Hz signal while using a crystal that divides evenly by the prescaler:
4, 8, and 16 MHz all work. The 32.768 kHz crystal also works with the 8-bit T0 or T2

Also use the CTC or PWM modes so the mega168 auto-reloads the timer.
are you saying that 16Mhz, 4Mhz and 8Mhz clock will also works for digital stop watch? but they don't divide evenly with 2^X to get 1 Hz.

Thanks
 

nanovate

Joined May 7, 2007
666
You could use Timer 1 in CTC mode and set OCRA1 = 0xf424 and the prescaler to 256 if you are using a 16MHz crystal. This is the clear timer on compare match mode which you set a value and the timer will count to that value then reload automagically while triggering an interrupt
 
Top