//T1溢出中断服务程序
#pragma interrupt_handler timer1_ovf_isr:9
void timer1_ovf_isr(void)
{
PORTA=~PORTA;//A口翻转
TCNT1L=0xF3;//重装初值
TCNT1H=0xFC;
}
//main函数
void main(void)
{
DDRA=0xff;
PORTA=0xff;
TCCR1A=0;
TCCR1B=0x05;
TCNT1L=0xF3;
TCNT1H=0xFC;
TIMSK =(1<<TOIE1) ; //定时器中断使能
SEI(); //开全局中断
while(1);
} |