|
/*
* mega16_interrupt.c
*
* Created: 2014/4/18 11:31:56
* Author: zxl
*/
#include
#include
#define uint unsigned int
volatile uint m;
int port_init()
{
DDRA=0XFF;
PORTA=0XFF;
return 0;
}
int interrupt_init()
{
TIMSK|=(1<
TCNT0=0; //初始值
TCCR0|=(1<
sei(); //开启全局中断
return 0;
}
ISR(TIMER2_OVF_vect)
{
TCNT0=0;
m++;
if (m<=5000)
PORTA=0x00;
if (m>5000)
PORTA=0xff;
{
}
}
int main(void)
{
interrupt_init();
port_init();
while(1)
{
}
}
AVRSTUDIO6这个软件为什么中断程序没有反应,怎么解决谢谢
|
|