中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > AT89C52控制溫度傳感器DS18B20并在LM016L_LCD上顯示

        AT89C52控制溫度傳感器DS18B20并在LM016L_LCD上顯示

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

        {
        tempt=0;
        i++;//延時(shí)
        tempt=1;
        i=8;//延時(shí)
        while(i>0)i--;
        }
        else
        {
        tempt=0;
        i=8;//延時(shí)
        while(i>0)i--;
        tempt=1;
        i++;//延時(shí)
        i++;
        }
        }
        }

        本文引用地址:http://www.antipu.com.cn/article/201807/383597.htm


        //----------------------------------------
        //函 數(shù) 名:convert_tempt()
        //函數(shù)類型:void
        //入口參數(shù):None
        //出口參數(shù):None
        //說(shuō)明:開(kāi)始獲取溫度,并進(jìn)行轉(zhuǎn)換
        //----------------------------------------
        void convert_tempt()
        {
        reset_tempt();//初始化
        delay(1);
        write_byte(0xcc);//跳過(guò)序列號(hào)讀取
        write_byte(0x44);//溫度轉(zhuǎn)換
        }

        //----------------------------------------
        //函 數(shù) 名:get_tempt
        //函數(shù)類型:uint
        //入口參數(shù):None
        //出口參數(shù):u_temp
        //說(shuō)明:獲取寄存器中的溫度數(shù)據(jù)
        //----------------------------------------
        uint get_tempt()
        {
        uchar a,b;//低位和高位
        reset_tempt();
        delay(1);
        write_byte(0xcc);
        write_byte(0xbe);//寫(xiě)入
        //讀數(shù)據(jù)命令

        a=read_tempt();
        b=read_tempt();//讀取值暫存
        u_temp=b;
        u_temp=8;
        u_temp|=a;//數(shù)據(jù)處理問(wèn)題
        //u_temp=u_temp/a;
        f_temp=u_temp*0.0625;//精度為12位,所以分辨率為0.0625
        u_temp=f_temp*10;//乘以10,將實(shí)際溫度擴(kuò)大10倍

        return u_temp;//返回的u_temp是整型數(shù)據(jù)
        }


        //----------------------------------------
        //函 數(shù) 名:display()
        //函數(shù)類型:void
        //入口參數(shù):None
        //出口參數(shù):None
        //說(shuō)明:顯示控制函數(shù)
        //----------------------------------------
        void display()
        {
        uchar i,j;
        write_com(0x80+3);
        for(i=0;i10;i++)
        {
        write_data(disp2[i]);
        }
        write_com(0x80+0x40+10);
        for(j=0;j2;j++)
        {
        write_data(disp3[j]);//單位顯示控制
        }
        }



        關(guān)鍵詞: AT89C52 溫度傳感器 DS18B20 LCD

        評(píng)論


        相關(guān)推薦

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

        關(guān)閉