avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Problem with Timer2 asynchronous operation on the 8535 mC


From: John Yannakopoulos
Subject: [avr-gcc-list] Problem with Timer2 asynchronous operation on the 8535 mC
Date: Tue, 23 Mar 2004 14:07:30 +0200 (EET)

Hi!

When I use the tc2 in synchronous operation, that's fine. But I want to use
it clocked from the internal oscillator (32768 Hz). I want the OUTPUT_COMPARE2
interrupt routine to be running at fixed intervals. Below is my tc2
initialization code snippet:

void Timer2_init (unsigned char interval, unsigned char scale)
{
        scale &= 0x7;
        scale |= 0x8;

        cbi (TIMSK, OCIE2);
        cbi (TIMSK, TOIE2);
        sbi (ASSR, AS2);
        outp (0x00, TCNT2);
        outp (interval, OCR2);
        outp (scale, TCCR2);
        while (ASSR & 0x7) ;

        cbi (TIFR, TOV2);
        cbi (TIFR, OCF2);
        sbi (TIMSK, OCIE2);
        sei ();
}

SIGNAL (SIG_OUTPUT_COMPARE2)
{
        bla, bla....
}

Why timer2 is not counting? I followed precisely the guidelines noted in
the mC's datasheet (page 44), but there is still a problem. What's that?
Please, help...

Best regards,

--
John Yannakopoulos.

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]