#include "iom16v.h"
#defineu char unsigned char
#define uint unsigned int
#define LED 6
uchar TIME_REG;
#pragma interrupt_handler timer2_ovf_isr:iv_TIMER2_OVF
void timer3_ovf_isr(void)
{
uchar temp;
temp=SREG;
TCNT2=0x15;
TIME_REG--;
If (TIME_REG==0)
{
TIME_REG=17;
PORTD^=(1<<LED);
}
SREG=temp;
}
void main(void)
{
SREG=0x00;
DDRD=0x40;
PORTD&=(1<<LED);
TCNT2=0x15;
TIMSK=0x40;
TCCR2=0x07;
TIME_REG=17;
SREG=0x80;
while(1)
{
}
}
|