<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)制作簡(jiǎn)易定時(shí)器

          單片機(jī)制作簡(jiǎn)易定時(shí)器

          作者: 時(shí)間:2016-11-18 來(lái)源:網(wǎng)絡(luò) 收藏

          系統(tǒng)圖:

          本文引用地址:http://www.ex-cimer.com/article/201611/315683.htm

          程序:

          #include
          unsigned char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,
          0x80,0x90};
          unsigned char count;
          unsigned char second,temp;
          bit alarmflag;
          void delay(unsigned int i)
          { unsigned char j;
          while(i--)for(j=248;j>0;j--);
          }
          void main()
          {
          TMOD=0x22;
          TH0=0x06;
          TL0=0x06;
          TH1=0x06;
          TL1=0x06;
          TR1=1;
          ET1=1;
          EA=1;
          ET0=1;
          P1=table[count/10];
          P0=table[count%10];
          while(1)
          {
          if(P3_2==0)
          {
          delay(20);
          if(P3_2==0)
          {
          count++;
          if(count==60){count=0;}
          P1=table[count/10];
          P0=table[count%10];
          }
          while(P3_2==0);temp=count;
          }
          else if(P3_3==0)
          {
          delay(20);
          if(P3_3==0)
          {
          TR0=1;
          }
          }
          }
          }
          void time0() interrupt 1
          {
          static unsigned int nn;
          nn++;
          if(nn==4000)
          {
          second=count--;
          P0=table[second%10];P1=table[second/10];
          if(second<=0){second=0;}
          }
          }
          void time1() interrupt 3
          {
          static unsigned int kk,ll,pp;
          kk++;
          if(kk==4000)
          {temp=count;
          ll++;
          if(ll==temp)
          {ll=0;P2_1=0;
          }
          pp++;
          if(pp==6)
          {P0=table[0xc0];P1=table[0xc0];P2_1=1;pp=0;}
          }
          }



          評(píng)論


          技術(shù)專(zhuān)區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();