Код
#include <mega16.h>
#include <delay.h>
// Timer 0 output compare interrupt service routine
interrupt [TIM0_COMP] void timer0_comp_isr(void)
{
// Place your code here
PORTB.0=~PORTB.0;
}
// Declare your global variables here
void main(void)
{
DDRB=1;
TCCR0=0b00011001;
TCNT0=0;
OCR0=150;
TIMSK |= (1 << 1);
SREG |= (1 << 7);
while (1)
{
};
}
#include <delay.h>
// Timer 0 output compare interrupt service routine
interrupt [TIM0_COMP] void timer0_comp_isr(void)
{
// Place your code here
PORTB.0=~PORTB.0;
}
// Declare your global variables here
void main(void)
{
DDRB=1;
TCCR0=0b00011001;
TCNT0=0;
OCR0=150;
TIMSK |= (1 << 1);
SREG |= (1 << 7);
while (1)
{
};
}
А теперь вопрос: как это записать красиво через ШИМ, но чтобы не было прерывания, а то получится тот же таймер.