- UID
- 780603
- 性别
- 男
|
大家好,我在用MC9S12XDT256这个片子来实现Flash Bootloader。需要用到中断重映射的功能,但是,我试着去try,发现有问题。现发一个附件,大家看看。
试验如下:
1. when I add this code "IVBR = 0x7Fu;" to main.c , this project is always reset.
2. when I delete this code "IVBR = 0x7Fu;" this project is running correctly.
main.c如下:
unsigned char test_flag = 0;
void main(void) {
/* put your own code here */
TSCR2 |= 0x84u; /* 16 Prescale Factor */
TSCR1 |= 0x80u; /* start timer */
//IVBR = 0x7F; /* delte this code ,the code is OK */
EnableInterrupts;
for(;;) {} /* wait forever */
/* please make sure that you never leave this function */
}
#pragma CODE_SEG NON_BANKED
#pragma TRAP_PROC SAVE_ALL_REGS
void ECT_OVERLOW(void)
{
test_flag++;
if(test_flag == 3)
{
for(;;);
}
}
#pragma CODE_SEG DEFAULT |
|