永发信息网

程序单步跟踪跳不出延时函数,求指导

答案:2  悬赏:20  手机版
解决时间 2021-02-07 19:25
  • 提问者网友:我一贱你就笑
  • 2021-02-07 08:27
#include
#define uchar unsigned char
#define uint unsigned int

uchar code DSY_CODE[]=
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x7f,0x6f,0x00};

sbit Clear_Key = P3^2;
sbit Clear_Key1 = P3^3;
sbit p=P0^0;
uchar Count=0;

void deliy(uchar i)
{
uint t;
while (i--)
{
for(t=0;t<120;t++);
}

}
void Show_Count_ON_DSY()
{

P1 = DSY_CODE[Count];
if(Count==8)
Count=-1;

}

void Show_Count_ON_DSY1()
{
uchar r;
for(r=0;r<=9;r++)
{

P2 =DSY_CODE[r];
deliy(500);

}

}

void main()
{

P1 = 0xff;
P1 = DSY_CODE[0];
P2 = 0xff;
P2 = DSY_CODE[0];
p=1;
EA = 1;
EX0 = 1;
EX1 = 1;
IT0 = 1;
IT1 = 1;
IP = 0;

while(1)
{

}
}

void EX_INT0(void) interrupt 0 using 1
{
p=0;
deliy(150);
p=1;
Count++;
Show_Count_ON_DSY();

}
void EX_INT1(void) interrupt 2 using 2
{

Show_Count_ON_DSY1();
}
最佳答案
  • 五星知识达人网友:夜余生
  • 2021-02-07 09:46
你的程序本身就有问题,delay(uchar i),但你调用时参数确实500.
全部回答
  • 1楼网友:雾月
  • 2021-02-07 11:01
void deliy(uchar i) {   uint t;   while (i--)     {        for(t=0;t<120;t++);     } }程序单步跟踪是可以跳出这个延时函数的。 只是需要单步太多的次数,如i=1,则需要循环120次
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯