[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] prescaler
From: |
Michael Tsao |
Subject: |
Re: [avr-gcc-list] prescaler |
Date: |
Wed, 12 Jun 2002 13:28:53 -0700 |
Can someone help me by explain what the prescaler is for when
using the timer function? I know it is remedial for most of you but I
really am having trouble finding good info on this. thanks B
You might not want your timer to count as fast as your avr is going. If you
have an 8MHz chip, an 8-bit timer set to a 1:1 timer/system clock ratio will
overflow in 0.000004 seconds (assuming exactly 8 million cycles per second),
and for many applications that's uselessly short.
So the prescaler says "make the timer tick only every X system cycles."
E.g., if you have it set to system clock/1024, then it ticks only every
1024th system cycle. On an 8MHz chip, an 8-bit timer will overflow in
0.032768 seconds (256 * 1024 * 1 / 8000000). Still short, but at least
that's milliseconds.
Basically you trade timer resolution for timer lifespan.
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
avr-gcc-list at http://avr1.org