#include <reg52.h>
#include <function.h>//详见第六章第8讲
u16 pulse=0;
void main()
{
u16 x,PULSE_buf;
IT1 = 1;
EX1 = 1;
EA = 1;
LED_Init();
KEY_Init();
ShowNumber(pulse);
while(1)
{
SEG_Scan();
if(PULSE_buf!=pulse)ShowNumber(pulse);
x++;
if(x>=50)
{
x=0;
PULSE_buf=pulse;
}
}
}
void EXTI1_IRQHandler() interrupt 2
{
pulse++;
}