AT91SAM7S128中断不能执行——求帮助;添加了Cstartup启动文件...
时间:10-02
整理:3721RD
点击:
__irq void timer0_c_irq_handler(void)
{
unsigned int dummy;//Acknowledge interrupt status
dummy = AT91C_BASE_TC0->TC_SR;//Suppress warning variable "dummy" was set but never used
dummy = dummy;
//ledlight();
if ((AT91C_BASE_PIOA->PIO_ODSR & LED_MASK)==0)
{
AT91C_BASE_PIOA->PIO_SODR= LED_MASK;//关LED
}
else AT91C_BASE_PIOA->PIO_CODR=LED_MASK;//开LED
}
void Tc0Init(void)
{
AT91F_TC0_CfgPMC();//配置TC0在电源管理器中打开定时器的时钟,AT91C_BASE_PMC寄存器写入1<<12(AT91C_ID_TC0),
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;//TC0禁用,/先在定时器内关闭时钟,TC0中断关闭
//TC0计数器模式设置,波形模式,与RC匹配后清零,
*AT91C_TC0_CMR =(AT91C_TC_CLKS_TIMER_div5_CLOCK|AT91C_TC_WAVE |AT91C_TC_WAVESEL_UP_AUTO);
AT91C_BASE_TC0->TC_RC = MCK/1024/2;//时钟为MCK的1024分频
AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS;
}
void AICInit(void)// Initialize AIC
{
AT91F_AIC_CfgPMC();//
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_TC0,1,
AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE,
(void(*)())timer0_c_irq_handler);
AT91F_AIC_EnableIt(AT91C_BASE_AIC,AT91C_ID_TC0);
}
{
unsigned int dummy;//Acknowledge interrupt status
dummy = AT91C_BASE_TC0->TC_SR;//Suppress warning variable "dummy" was set but never used
dummy = dummy;
//ledlight();
if ((AT91C_BASE_PIOA->PIO_ODSR & LED_MASK)==0)
{
AT91C_BASE_PIOA->PIO_SODR= LED_MASK;//关LED
}
else AT91C_BASE_PIOA->PIO_CODR=LED_MASK;//开LED
}
void Tc0Init(void)
{
AT91F_TC0_CfgPMC();//配置TC0在电源管理器中打开定时器的时钟,AT91C_BASE_PMC寄存器写入1<<12(AT91C_ID_TC0),
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;//TC0禁用,/先在定时器内关闭时钟,TC0中断关闭
//TC0计数器模式设置,波形模式,与RC匹配后清零,
*AT91C_TC0_CMR =(AT91C_TC_CLKS_TIMER_div5_CLOCK|AT91C_TC_WAVE |AT91C_TC_WAVESEL_UP_AUTO);
AT91C_BASE_TC0->TC_RC = MCK/1024/2;//时钟为MCK的1024分频
AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS;
}
void AICInit(void)// Initialize AIC
{
AT91F_AIC_CfgPMC();//
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_TC0,1,
AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE,
(void(*)())timer0_c_irq_handler);
AT91F_AIC_EnableIt(AT91C_BASE_AIC,AT91C_ID_TC0);
}