Привет всем!
Вообщем багу нашел в симуляторе AVR Studio. Написал на Atmel. Ответили. Вот эту инфу и привожу может кому поможет, сам день потерял..
> When PWM channel is enabled the overflow interrupt is not called in simulator
> by some reason. Due to this loop runs endless as exit variable is not
> changing in interrupt code.
> (pulses_sent is volatile).
>
> SIGNAL(SIG_OVERFLOW2)
> {
> if(pulse_count == 0)
> {
> pulse_count = 5
> TCCR2 = TCCR2 & (~0x07); /* stop PWM */
>
> pulses_sent = TRUE;
> }
> else
> {
> TCNT2 = 130;
> pulse_count--;
> }
> }
>
>
>
> .
> .
> pulses_sent = FALSE;
>
> /* PWM Output.
> TCCR2 = _BV(WGM20)
> | _BV(CS20)
> | _BV(COM21);
> OCR2 = 50;
>
> TIMSK = _BV(TOIE2);
> sei();
>
>
> /* wait for the pulse */
> while(pulses_sent == FALSE)
> {
> }
>
> so it runs here forever in simulator, there seem there is no flag when timer
> counts to 0 as datasheet says.
>
> Alex
----------------------------------------------------------
Message added by Stian Oroe Moen, 02.11.2007 10:17
Dear Mr ...
Thank you for your report. Bug reports are highly appreciated. I have tested and verified the odd behaviour and reported it. We are now working on designing a Simulator II and hopefully this bug will be fixed in this version before it is released. I don't have any release date for ATmega16 support in sim II so in the mean time I suggest you try on chip debugging which will give a more reliable result.
Best Regards
Stian Oroe Moen
Atmel AVR Technical Support
--------------------------------
AVR support and FAQ:
http://support.atmel.no/Atmel AVR page:
http://www.atmel.com/products/avr/Info and software:
http://www.avrfreaks.netDiscussion forum:
http://www.avrfreaks.net/phorum/Distributors:
http://www.atmel.com/dyn/general/contact.asp