在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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ī)秒表程序(帶仿真)

            精確到千分之一秒的單片機(jī)秒表程序(帶仿真)

            作者: 時(shí)間:2016-11-30 來(lái)源:網(wǎng)絡(luò) 收藏
            這個(gè)秒表程序是51hei單片機(jī)開(kāi)發(fā)光盤(pán)里面附帶的一個(gè)程序,可精確到千分之一秒,附件里面有仿真文件和hex文件.下載地址:http://www.51hei.com/bbs/dpj-19342-1.html

            #include
            #include
            #define uint unsigned int
            #define uchar unsigned char
            sbit duxa=P2^6;
            sbit wexa=P2^7;
            sbit k1=P1^2;
            sbit k2=P1^3;
            sbit k3=P1^4;
            uchar temp,qian,bai,shi,ge;
            uint num,a,shu;
            uchar code table[]={
            0x3f,0x06,0x5b,0x4f,
            0x66,0x6d,0x7d,0x07,
            0x7f,0x6f,0x77,0x7c,
            0x39,0x5e,0x79,0x71};
            void init();
            void delay(uint z);
            void display(uchar num,uchar qian,uchar bai,uchar shi,uchar ge);
            void main()
            {
            init();
            while(1)
            {
            display(num,qian,bai,shi,ge);
            if(k1==0)
            {
            delay(1);
            TR0=0;
            delay(1);
            }
            if(k2==0)
            {
            delay(1);
            TR0=1;
            delay(1);
            }
            if(k3==0)
            {
            delay(1);
            a=0;
            num=0;
            TR0=1;
            delay(1);

            }

            }
            }
            void init()
            {
            num=0;
            temp=0xf0;
            TMOD=0x01;
            TH0=(65536-1000)/256;
            TL0=(65536-1000)%256;
            EA=1;
            ET0=1;
            TR0=1;
            bai=0;
            shi=0;
            ge=0;
            a=0;
            k1=1;
            k2=1;
            k3=1;
            }
            void delay(uint z)
            {
            uint x,y;
            for(x=z;x>0;x--)
            for(y=110;y>0;y--);
            }
            void timer0() interrupt 1
            {
            TH0=(65536-1000)/256;
            TL0=(65536-1000)%256;
            a++;

            if(a==9999)
            {
            a=0;
            num++;
            if(num==10)
            num=0;

            }
            shu=a;
            qian=shu/1000;
            bai=shu%1000/100;
            shi=shu%100/10;
            ge=shu%10;
            }

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

            void display(uchar num,uchar qian,uchar bai,uchar shi,uchar ge)
            {
            wexa=1;
            P0=0xfe;
            wexa=0;
            P0=0;
            duxa=1;
            P0=table[num];
            duxa=0;
            P0=0xff;
            delay(1);


            wexa=1;
            P0=0xfd;
            wexa=0;
            P0=0;
            duxa=1;
            P0=table[qian];
            duxa=0;
            P0=0xff;
            delay(1);


            wexa=1;
            P0=0xfb;
            wexa=0;
            P0=0;
            duxa=1;
            P0=table[bai];
            duxa=0;
            P0=0xff;
            delay(1);

            wexa=1;
            P0=0xf7;
            wexa=0;
            P0=0;
            duxa=1;
            P0=table[shi];
            duxa=0;
            P0=0xff;
            delay(1);

            wexa=1;
            P0=0xef;
            wexa=0;
            P0=0;
            duxa=1;
            P0=table[ge];
            duxa=0;
            P0=0xff;
            delay(1);
            }



            評(píng)論


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

            關(guān)閉