|
瑞萨78K0单片机当在软件仿真时,点运行后,在中断函数中设断点,不会停,认为是没有进到中断中来,但需要开启的寄存器都已设好。
想问一下,在软件仿真时本来就是这样吗?还是 需要开启什么命令?现在手头没有仿真器,不能硬件仿真。测试程序如下:
#pragma sfr
#pragma ei
#pragma di
#pragma nop
#pragma interrupt INTTM000 INTM000
#pragma interrupt INTTM010 INTM010
#define uint unsigned int
#define uchar unsigned char
volatile uint gTm00PosWidth = 0;
volatile uint gTm00NegWidth = 0;
volatile uint gTm00PosWidth1 = 0;
volatile uint gTm00NegWidth1 = 0;
uint tm00_pul_cur_0 = 0;
uint tm00_pul_cur_1 = 0;
uint lowlength,i;
uchar highlength;
uchar highcount;
void time00_init(void)
{
TMC00 = 0X00;
TMMK000 = 1;/*disable INTTM000 interrupt*/
TMIF000 = 0;/*clear INTTM000 interrupt flag*/
TMMK010 = 1;/*disable INTTM010 interrupt*/
TMIF010 = 0;/*clear INTTM010 interrupt flag*/
TMPR010 = 1;
PRM00 = 0X11;
CRC00 = 0X07;
P0.0 = 0;
PM0.0 = 1;
P3.2 = 1;
PM3.2 = 0;
PM6.1 = 1;
P6.1 = 0;
}
void main(void)
{
DI();
WDTE = 0XAC;
time00_init();
TMIF010 = 0;
TMMK010 = 0;
TMC00 &= (uchar)~0x0c;
TMC00 |= 0x08;
EI();
while(1)
{
for(i = 0;i < lowlength;i ++)
{
NOP();
NOP();
WDTE = 0XAC;
}
}
}
__interrupt void INTM000()
{
}
__interrupt void INTM010()
{
TMC00 &= (uchar)~0x01; /* OVF00 clear */
tm00_pul_cur_0 = CR010;
tm00_pul_cur_1 = CR000;
gTm00PosWidth = tm00_pul_cur_1;
gTm00NegWidth = tm00_pul_cur_0 - tm00_pul_cur_1;
lowlength = tm00_pul_cur_1;
highcount++;
if(highcount == 250)
{
highcount = 0;
P3.2 = ~P3.2;
}
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|