首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

请版主一定要看,关于中断嵌套!

请版主一定要看,关于中断嵌套!

为了试验dg128中断嵌套,我编写了如下程序:
设置定时中断0、1、2,默认优先级。进入0定时中断后,我打开1定时中断,关闭2定时中断,并打开全局中断,然后做死循环;1定时中断服务程序每隔5000个定时计数器对PORTB_BIT0位取反;2定时器中断服务程序每隔7000个定时计数器对PORTA_BIT0位取反。
程序结果如我设想那样运行——PORTB_BIT0位不断在做取反运算,PORTA_BIT0位始终不变。
但我让程序运行了一会后,它自动停止了并报错:
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0xC0, Memory Address: 0x3FF.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0x0, Memory Address: 0x3FD.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0x0, Memory Address: 0x3FE.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0xC0, Memory Address: 0x3FB.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0x49, Memory Address: 0x3FC.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0x1, Memory Address: 0x3F9.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0x1B, Memory Address: 0x3FA.
FCS Warning (ID 25): writing to reserved register at pc = 0xc021. Value: 0xC0, Memory Address: 0x3F8.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3F8.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3F9.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FA.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FB.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FC.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FD.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FE.
FCS Warning (ID 26): reading from reserved register at pc = 0xc035. Value: 0x0, Memory Address: 0x3FF.
FCS Warning (ID 26): reading from reserved register at pc = 0x1. Value: 0x0, Memory Address: 0x4. MEBI module is affected.
FCS Warning (ID 26): reading from reserved register at pc = 0x1. Value: 0x0, Memory Address: 0x5. MEBI module is affected.
ILLEGAL_BP

请问版主这是怎么回事呢??

其次,版主在以前的帖子中提到,尽量不要用中断嵌套,说太占用资源,这是为什么?
谢谢!
学习中...
程序如下

#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"


void Time_Init(void);


void main(void) {
DDRA=0x01;
DDRB=0x01;
Time_Init();

EnableInterrupts;

for(;;) {}

}


void Time_Init(void){
TSCR2=0x07;
TIOS=0xff; //定义time0到time3口为输入捕捉,time4到time7为输出比较
TIE=0x07; //打开time0,time1,time2中断
TSCR1=0x80; //时钟模块使能位;
TFLG1=0xFF; //清除标志位
TC1=TCNT+5000;
TC2=TCNT+7000;
}



#pragma CODE_SEG NON_BANKED
void interrupt 8 time0(void){

TFLG1=0x01; //清除标志位
TIE_C1I=1;
TIE_C2I=0;
EnableInterrupts;
for(;;){
;
}
// TIE_C2I=1;
}

#pragma CODE_SEG NON_BANKED
void interrupt 9 time1(void){
TFLG1=0x02;
TC1=TC1+5000;
PORTB_BIT0=~PORTB_BIT0;

}

#pragma CODE_SEG NON_BANKED
void interrupt 10 time2(void){
TFLG1=0x04;
TC2=TC2+7000;
PORTA_BIT0=~PORTA_BIT0;
}
学习中...
那如果我一定要用中断嵌套的话,有没有解决办法啊?

还有,版主在以前的帖子中提到,尽量不要用中断嵌套,说太占用资源,这是为什么?

谢谢!
学习中...
Thank you very much!
学习中...
返回列表