本人使用ICD2调试30F3012,软件为MPLAB7.50,C30 V1.20 项目中添加的链接文件为p30f3012.gld, #include "p30f3012.h" unsigned int T1Buffer[16],T2Buffer[16]; unsigned int WPointer; unsigned char over; void testport(void); void timer1_init(void); nt main(void) { /* pc = 0x180 */ /* unsigned int xdata[512]; union xx{ unsigned char v1[2]; unsigned int v2; }utest; */ unsigned int i,step; unsigned int y; /* variable init */ WPointer = 0; over = 1;
for(i=0;i<16;i++) { T1Buffer = i; T2Buffer = i; } /* port init */ testport();
/* timer init */ timer1_init();
while(over);
while(1); }
void __attribute__((__interrupt__)) _T3Interrupt(void) {
IFS0bits.T3IF = 0; T1Buffer[WPointer] = TMR1; T2Buffer[WPointer] = TMR2; WPointer++; T1CONbits.TON = 0; T2CONbits.TON = 0; TMR1 = 0; TMR2 = 0; if(WPointer&0x10){ IEC0bits.T3IE = 0; T1CONbits.TON = 0; over = 0; } else{ T1CONbits.TON = 1; T2CONbits.TON = 1; } return; }
void timer1_init(void) { T1CON = 0x0002; TMR1 = 0x0000; PR1 = 0xffff; T2CON = 0x0002; TMR2 = 0x0000; PR2 = 0xffff; T3CON = 0x0000; TMR3 = 0x0000; PR3 = 0x2710; /* period = 1.25ms */ IPC1bits.T3IP = 0x4; IPC1bits.T2IP = 0x0; IPC0bits.T1IP = 0x0; IEC0bits.T3IE = 1; T3CONbits.TON = 1; T1CONbits.TON = 1; T2CONbits.TON = 1; } 调试发现T1Buffer and T1Buffer 均为restricted memory 中断中对 T1Buffer and T1Buffer操作无效 我在microchipmplab idedev的文件夹中dspic30f3012e.dev中的第39行有 UnusedRegs (0x800-0x13ff) 在dspic30f3012e.dev中没有发现0x800以上的限制阿 如果我用MPLAB SIM来仿真则没有任何问题 请教各位大虾,如何解决阿?????? |