1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1490|回復: 0
收起左側

我的單片機24s計時器

[復制鏈接]
ID:416198 發表于 2018-10-27 10:57 | 顯示全部樓層 |閱讀模式
#define uchar unsigned char
#define uint unsigned int
#include <REGX51.H>
#include <intrins.h>
sbit    BEEP=P0^0;
sbit        LED=P1^1;
sbit        CLEAR=P1^2;
sbit        START=P1^3;
#define uchar unsigned char
#define uint unsigned int
void    delay(unsigned int i )
{
    while(i--);
}
void   main()
{
   uint T_Count = 0;
   uchar count;

   LED=1;
   BEEP=1;

   CLEAR =1;
   START =1;

   TMOD=0X01;
   TH0=(65535-50000)/256;
   TL0=(65535-50000)/256;

   while(START);
   TR0=1;
   count=48;
   while(1)
        {
         if(TF0==1)
         TF0=0;
         TH0=(65535-50000)/256;
         TL0=(65535-50000)/256;
         if(++T_Count==10)
         {
          T_Count=0        ;
          LED=LED;

          count--;
          if(count=0)
          {
           while(CLEAR)
           {
            BEEP=1;
                delay(200);
                BEEP=0;
                delay(200);
                }
                BEEP=1;
                while(START);
                count=48;
        }
}
}
}


回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表