You
would need to set up a timer. This is my timer0 init code from a m128
16MHZ
* Initialize timer0 to generate an output compare interrupt,
and
* set the output compare register so that we get that
interrupt
* every millisecond.
*/
TIFR |= BV(OCIE0);
TCCR0 = BV(WGM01)|BV(CS02)|BV(CS00); /*
CTC, prescale = 128 */
TCNT0 = 0;
TIMSK |=
BV(OCIE0); /* enable output compare interrupt */
OCR0 =
MS_OCRMATCH; /* match in 1
ms normal value = 125 */
The
formula is
clock
io
------------
N *
256 where N = 1,8,32,64,128,256,1024
to
figure out what N you need
1st do
8000000/256=31250
31250/150 = 208 which is between 128 and 256.
Hi i am new in winavr i need to set a delay of 150hz i am using a 8Mhz
clock
Help me
Do you Yahoo!?
Better first dates. More second dates. Yahoo!
Personals