51单片机秒表程序.docVIP

  • 68
  • 0
  • 约1.66千字
  • 约 4页
  • 2023-10-08 发布于浙江
  • 举报
51单片机 秒表程序 /* 1、程序目的:使用定时器学习秒表计时,中断0控制走表,中断1控制清零 2、硬件要求:数码管、晶振12M */ #include reg52.h code unsigned char tab[]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //共阴数码管 0-9 unsigned char Dis_Shiwei;//定义十位 unsigned char Dis_Gewei; //定义个位 unsigned char S_Dis_Shiwei;//定义秒十位 unsigned char S_Dis_Gewei; //定义秒个位 unsigned char second,msecond; void CLR(void); void delay(unsigned int cnt) { while(--cnt); } main() { ) EX0=1;//外部中断0设置(打开外部中断0 IT0=1; EX1=1;//外部中断1设置 IT1=1;//INT1为跳变沿触发方式 TMOD |=0x01;//定时器设置 10ms in 12M crystal TH0=0xd8;/11110000初值为55536 定时10ms,算死俺啦。 TL0=

文档评论(0)

1亿VIP精品文档

相关文档