方法类似,补写程序如下:
#include
#define uint unsigned int
#define uchar unsigned char
sbit LED=P0^0;
sbit LED1=P0^1;
void delay1ms (uint z)
{
uint x,y;
for (x=z;x>0;x--)
for (y=110;y>0;y--);
}
void exter() interrupt 2
{
delay1ms(600);
LED=0;
delay1ms(200);
LED=1;
}
void exter0() interrupt 0
{
delay1ms(600);
LED1=1;
delay1ms(200);
LED1=0;
}
main()
{
EA=1; //开总中断
EX1=1; //开外部中断1
EX0=1; //开外部中断0
IT1=0; //外部中断边沿触发,下降沿触发
IT0=0; //外部中断0边沿触发,下降沿触发
}