#include <iom32v.h>
#include <macros.h>
void time1_init(void)
{
TCCR1B = 0x00;
TCNT1H = 0xE3;
TCNT1L = 0xE1;
TCCR1A = 0x00;
TCCR1B = 0X05;
MCUCR = 0X00;
GICR = 0X00;
TIMSK = 0X04;
}
#pragma interrupt_handler timer1_ovf_isr:10
timer1_ovf_isr(void)//TC1定时中断服务程序
{
TCNT1H = 0xE3;
TCNT1L = 0xE1;
PORTD ^= 0X01;
}
main(void)
{
PORTD = 0xFF;
DDRD = 0xFF;
time1_init();
SEI();
while(1);
{}
} |