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

標(biāo)題: 單片機(jī)99s精確倒計(jì)時(shí)程序及仿真 [打印本頁]

作者: 白事可樂    時(shí)間: 2016-12-4 22:59
標(biāo)題: 單片機(jī)99s精確倒計(jì)時(shí)程序及仿真
99s精確倒計(jì)時(shí)

  1. #include<reg52.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. char i;
  5. char ctime=99;
  6. uchar code led[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  7. void main()
  8. {
  9.   TMOD=0X01; //設(shè)定定時(shí)器為工作方式1
  10.   TH0=(65536-45872)/256; //裝初值,11.0592 MHZ晶振定時(shí)50MS,計(jì)數(shù)值為45872
  11.   TL0=(65536-45872)%256;
  12.   EA=1;   //打開總中斷
  13.   ET0=1;  //打開定時(shí)器中斷
  14.   TR0=1;  //啟動(dòng)定時(shí)器0
  15.   while(1)
  16.   {
  17.    P0=led[ctime/10];
  18.    P2=led[ctime%10];

  19.   }

  20. }
  21.    void time() interrupt   //定時(shí)器0中斷服務(wù)程序
  22. {
  23.   TH0=(65536-45872)/256;   //重裝初值
  24.   TL0=(65536-45872)%256;   
  25.   i++;
  26.   if(i==20)                //如果i=20,說明1s時(shí)間到
  27.   {
  28.    i=0;
  29.    ctime--;
  30.    if(ctime<0)
  31.    {
  32.     ctime=99;
  33.   }
  34. }  
  35. }
復(fù)制代碼

99s精確倒計(jì)時(shí).rar

49.35 KB, 下載次數(shù): 16, 下載積分: 黑幣 -5


作者: daxionghhh    時(shí)間: 2016-12-5 11:42
可以哦




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