proteus仿真,中断无反应是怎么回事?
#include<reg51.h>#include<intrins.h>unsignedchara,b;voiddelay(unsignedcharx){unsigned...
#include <reg51.h>
#include <intrins.h>
unsigned char a,b;
void delay(unsigned char x)
{
unsigned int y = 5000;
while(x--)
while(y--);
}
void main()
{
EA = 1;
EX0 = 1;
EX1 = 1;
IT0 = 1;
IT1 = 1;
IP = 0x04;
P0 = 0x01;
while(1)
{
P0 = _crol_(P0,1);
delay(2);
}
}
void INT_0() interrupt 0
{
a = P0;//保护现场
P0 = 0xff;//LED灯全亮
delay(8);
P0 = a;//恢复现场
}
void INT_1() interrupt 2
{
b = P0;//保护现场
P0 = 0x00;//LED灯全灭
delay(8);
P0 = b;//恢复现场
} 展开
#include <intrins.h>
unsigned char a,b;
void delay(unsigned char x)
{
unsigned int y = 5000;
while(x--)
while(y--);
}
void main()
{
EA = 1;
EX0 = 1;
EX1 = 1;
IT0 = 1;
IT1 = 1;
IP = 0x04;
P0 = 0x01;
while(1)
{
P0 = _crol_(P0,1);
delay(2);
}
}
void INT_0() interrupt 0
{
a = P0;//保护现场
P0 = 0xff;//LED灯全亮
delay(8);
P0 = a;//恢复现场
}
void INT_1() interrupt 2
{
b = P0;//保护现场
P0 = 0x00;//LED灯全灭
delay(8);
P0 = b;//恢复现场
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询