51单片机外部中断问题
#include<reg52.h>typedef unsigned char u8;
typedef unsigned int u16;
sbit KEY = P3^1;
sbit led = P2^0;
void delay(u16 num)
{
u16 x ,y;
for (x=num;x>0;x--) ;
for(y=110;y>0;y--) ;
}
int main (void)
{
TCON| = 0x01;
IE =0X81 ;
while(1);
{
;
}
}
void ext_int0 (void) interrupt 0
{
delay(10);
if (KEY ==0)
{
led =~led;
}
while(!KEY);
}