欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機定時計數(shù)器實現(xiàn)1分鐘計時程序+Proteus仿真 [打印本頁]

作者: 158751hei0141    時間: 2020-4-12 17:25
標題: 單片機定時計數(shù)器實現(xiàn)1分鐘計時程序+Proteus仿真
僅是一次訓練,同時希望各位指導糾 ,僅供參考,請斟酌下載!!!

單片機源程序如下:
  1. #include<reg52.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. sbit key=P3^0;
  5. sbit P20=P2^0;
  6. sbit P21=P2^1;
  7. sbit beep=P3^1;
  8. uchar i,count=0,count0=0,count1=0;
  9. uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};

  10.                                      
  11. void Timer0()
  12. {
  13.         i=0;
  14.         P20=0;P21=0;beep=1;
  15.         P1=0xff;
  16.         TMOD|=0x01;
  17.         TH0=0xD8;                  //定時10ms
  18.         TL0=0xF0;
  19.         ET0=1;
  20.         EA=1;
  21.         TR0=1;
  22. }

  23. void display()
  24. {
  25.     count0=count%10;
  26.         count1=count/10%10;
  27.         P1=table[count0];
  28.         P21=1;P21=0;
  29.         P1=table[count1];
  30.         P20=1;P20=0;
  31.        
  32. }

  33. void timer0isr(void) interrupt 1 using 1
  34. {
  35.         TH0=0xD8;
  36.         TL0=0xF0;
  37.         i++;
  38.         if(i==100)
  39.         {
  40.             i=0;
  41.                 count++;
  42.                 if(count>=60)
  43.                 {
  44.                 count=60;
  45.                 beep=~beep;
  46.                 if(key==0)
  47.                 count=0;
  48.                 }               
  49.         }
  50. }

  51. void main()
  52. {
  53.     Timer0();
  54.     while(1)
  55.     {
  56.          display();
  57.     }
  58. }
復制代碼

所有資料51hei提供下載:
一分鐘計時.rar (52.96 KB, 下載次數(shù): 33)






歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1