在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)--電子時(shí)鐘(C51)

            單片機(jī)--電子時(shí)鐘(C51)

            作者: 時(shí)間:2016-11-22 來(lái)源:網(wǎng)絡(luò) 收藏
            //簡(jiǎn)單電子時(shí)鐘的C程序代碼,沒(méi)有消隱,沒(méi)有按鍵功能

            //author:helloword

            本文引用地址:http://www.biyoush.com/article/201611/319588.htm

            #include

            #defineuintunsignedint

            #defineucharunsignedchar

            sbitsegoe=P1^3;//數(shù)碼管的使能控制端,低電平有效

            sbitduanxuan=P1^4;//數(shù)碼管的段選控制,7段發(fā)光LED顯示

            sbitweixuan=P1^5;//數(shù)碼管的位選控制,8個(gè)數(shù)碼管的選擇

            ucharcodesmg_duan[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//數(shù)碼管段選碼表,我們的數(shù)碼管是共陰極數(shù)碼管

            ucharcodesmg_wei[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};

            uinttime_flag=20;

            uintsecond=0;

            uintminute=02;

            uinthour=10;

            voiddisplay();

            voiddelay(uint);

            voidmain()

            {

            TMOD=0x01;

            TH0=(65536-50000)/256;

            TL0=(65536-50000)%6;

            TR0=1;

            ET0=1;

            EA=1;

            segoe=0;

            while(1)

            display();

            }

            voidInt_T0(void)interrupt1

            {

            TH0=(65536-50000)/256;

            TL0=(65536-50000)%6;

            time_flag--;

            if(time_flag==0)

            {

            second++;

            time_flag=20;

            }

            }

            voiddisplay()

            {

            uintsec_1,sec_2;

            uintmin_1,min_2;

            uinthou_1,hou_2;

            weixuan=1;

            P0=smg_wei[2];

            weixuan=0;

            duanxuan=1;

            P0=0x40;

            duanxuan=0;

            delay(3);

            weixuan=1;

            P0=smg_wei[5];

            weixuan=0;

            duanxuan=1;

            P0=0x40;

            duanxuan=0;

            delay(3);

            if(second<60)

            {

            sec_2=second/10;

            sec_1=second;

            weixuan=1;

            P0=smg_wei[0];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[sec_1];

            duanxuan=0;

            delay(3);

            weixuan=1;

            P0=smg_wei[1];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[sec_2];

            duanxuan=0;

            delay(3);

            }

            if(minute<60)

            {

            min_2=minute/10;

            min_1=minute;

            weixuan=1;

            P0=smg_wei[3];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[min_1];

            duanxuan=0;

            delay(3);

            weixuan=1;

            P0=smg_wei[4];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[min_2];

            duanxuan=0;

            delay(3);

            }

            if(hour<24)

            {

            hou_2=hour/10;

            hou_1=hour;

            weixuan=1;

            P0=smg_wei[6];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[hou_1];

            duanxuan=0;

            delay(3);

            weixuan=1;

            P0=smg_wei[7];

            weixuan=0;

            duanxuan=1;

            P0=smg_duan[hou_2];

            duanxuan=0;

            delay(3);

            }

            if(second==60){minute++;second=0;}

            if(minute==60){hour++;minute=0;second=0;}

            if(hour==24){second=0;minute=0;hour=0;}

            }

            voiddelay(uintz)

            {

            uinti,j;

            for(i=z;i>0;i--)

            for(j=95;j>0;j--);

            }



            評(píng)論


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

            關(guān)閉