51单片机 芯片是89C52 实现秒表计时器 一到59秒循环 到59秒可实现风铃器发声 可实现中断 按一下可暂停 再按一下 可继续 以下是程序 求每一项的解释注明 因为我看不懂什么意思 很急
#include<reg52.h>unsigned char x,y;sbit H=P3^6;unsigned char D[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};void delay(unsigned char a){ unsigned char i; while(a--) for(i=115;i>0;i--);}void display(unsigned char x){ P2=0x7f; P0=D[x%10]; delay(5); P2=0xbf; P0=D[x/10]; delay(5);}void main(){ x=y=0; EA=1; EX0=1; IT0=1; ET0=1; TMOD=0X01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; TR0=1; while(1) { display(x); if(x==59) H=~H; }
}void int0() interrupt 1{ y++; while(y==20) { y=0; x++; if(x==60) x=0; } TH0=(65536-50000)/256; TL0=(65536-50000)%256; } void it0() interrupt 0 using 1{ ET0=~ET0;
}