在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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)用 > LCD1602液晶顯示屏顯示時(shí)鐘且能修改時(shí)間

            LCD1602液晶顯示屏顯示時(shí)鐘且能修改時(shí)間

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

            void display(uchar hour,uchar minutes,uchar seconds)//接收并發(fā)送數(shù)據(jù)到液晶屏幕
            {
            uchar hourge,hourshi,minutesshi,minutesge,secondsshi,secondsge;
            hourshi=hour/10;
            hourge=hour%10;
            write_command(0x80+0x40);
            write_date(hourshi+48);
            delay(1);
            write_date(hourge+48);
            delay(1);

            本文引用地址:http://www.biyoush.com/article/201612/324165.htm

            minutesshi=minutes/10;
            minutesge=minutes%10;
            write_command(0x80+0x43);
            write_date(minutesshi+48);
            delay(1);
            write_date(minutesge+48);
            delay(1);

            secondsshi=seconds/10;
            secondsge=seconds%10;
            write_command(0x80+0x46);
            write_date(secondsshi+48);
            delay(1);
            write_date(secondsge+48);
            delay(1);
            }
            void revise()
            {
            if(K1==0)
            {
            delay(5);
            if(K1==0)
            {
            cnt++;//計(jì)數(shù)第幾次按下
            TR0=0;
            }
            while(!K1);
            delay(5);
            while(!K1);
            }
            if(cnt==1)//第一次按下,調(diào)整秒鐘,調(diào)整時(shí)秒鐘有光標(biāo)閃爍
            {
            write_command(0x80+0x46);
            write_command(0x0f);
            if(K2==0)
            {
            delay(5);
            if(K2==0)
            {
            seconds++;
            if(seconds==60)
            {
            seconds=0;
            }
            }
            while(!K2);
            delay(5);
            while(!K2);
            }
            if(K3==0)
            {
            delay(5);
            if(K3==0)
            {
            seconds--;
            if(seconds==-1)//here is a bug
            {
            seconds=59;
            }
            }
            while(!K3);
            delay(5);
            while(!K3);
            }
            }

            if(cnt==2)//第二次按下,調(diào)整分鐘,調(diào)整時(shí)秒鐘有光標(biāo)閃爍
            {
            write_command(0x80+0x43);
            write_command(0x0f);
            if(K2==0)
            {
            delay(5);
            if(K2==0)
            {
            minutes++;
            if(minutes==60)
            {
            minutes=0;
            }
            }
            while(!K2);
            delay(5);
            while(!K2);
            }
            if(K3==0)
            {
            delay(5);
            if(K3==0)
            {
            minutes--;
            if(minutes==-1)//here is a bug
            {
            minutes=59;
            }
            }
            while(!K3);
            delay(5);
            while(!K3);
            }
            }
            if(cnt==3)//第三次按下,調(diào)整時(shí)鐘,調(diào)整時(shí)秒鐘有光標(biāo)閃爍
            {
            write_command(0x80+0x40);
            write_command(0x0f);
            if(K2==0)
            {
            delay(5);
            if(K2==0)
            {
            hour++;
            if(hour==24)
            {
            hour=0;
            }
            }
            while(!K2);
            delay(5);
            while(!K2);
            }
            if(K3==0)
            {
            delay(5);
            if(K3==0)
            {
            hour--;
            if(hour==-1)//here is a bug
            {
            hour=23;
            }
            }
            while(!K3);
            delay(5);
            while(!K3);
            }
            }
            if(cnt==4)
            {
            TR0=1;
            cnt=0;
            }
            }
            void main()
            {
            LCDinit();
            Time0init();
            Clockinit();
            while(1)
            {
            revise();
            display(hour,minutes,seconds);
            }
            }
            void Time0() interrupt 1
            {
            TH0=(65536-50000)/256;
            TL0=(65536-50000)%256;
            count++;
            if(count==20)
            {
            count=0;
            seconds++;
            if(seconds==60)
            {
            seconds=0;
            minutes++;
            if(minutes==60)
            {
            minutes=0;
            hour++;
            if(hour==24)
            {
            hour=0;
            }
            }
            }
            }
            }


            上一頁(yè) 1 2 下一頁(yè)

            評(píng)論


            技術(shù)專區(qū)

            關(guān)閉