#include <mega8.h> // 8.00 мГц
int sin[128]={127,134,140,146,152,158,164,170,176,182,187,193,198,203,208,213,217,222,226,230,233,
236,240,242,245,247,249,251,252,253,254,254,254,254,254,253,252,251,249,247,245,242,
240,236,233,230,226,222,217,213,208,203,198,193,187,182,176,170,164,158,152,146,140,
134,127,121,115,109,103,97,91,85,79,73,68,62,57,52,47,42,38,33,29,25,22,19,15,13,10,
8,6,4,3,2,1,1,0,1,1,2,3,4,6,8,10,13,15,19,22,25,29,33,38,42,47,52,57,62,68,73,79,85,
91,97,103,109,115,121};
int i;
interrupt [TIM1_COMPA] void timer1_compa_isr(void) {
OCR2=sin;
i++;
if (i>127) i=0;
}
void main(void)
{
PORTB=0x00;
DDRB=0x08;
TCCR1B=0x09; //WGM12=1(CTC); CS10=1
OCR1AH=0x02;
OCR1AL=0x00;
TCCR2=0x69; //WGM20=1(PWM, Phase); COM21=1(Clear OC2 on compare match); WGM21=1; CS20=1
OCR2=0x00;
TIMSK=0x10; //OCIE1A=1
#asm("sei")



