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

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

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

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

      2. 新聞中心

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

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

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

        lcden=0;
        delay(5);
        }


        //----------------------------------------
        //函 數(shù) 名:lcd_init
        //函數(shù)類型:void
        //入口參數(shù):None
        //出口參數(shù):None
        //說明:液晶初始化
        //----------------------------------------
        void lcd_init()
        {
        lcden=0;
        lcdrw=0;
        write_com(0x38); //顯示模式
        write_com(0x0c); //開顯示,關(guān)光標(biāo)
        write_com(0x06); //寫字符后地址加1,光標(biāo)加1
        write_com(0x01); //清屏
        }


        //----------------------------------------
        //函 數(shù) 名:display_tempt
        //函數(shù)類型:void
        //入口參數(shù):None
        //出口參數(shù):None
        //說明:溫度數(shù)據(jù)顯示
        //----------------------------------------
        void display_tempt(uint date)
        {
        uchar i,j,k;
        i=date/100;//十位
        j=date0/10;//個位
        k=date0;//小數(shù)位
        write_com(0x80+0x40+5);
        write_data(disp[i]);
        write_data(disp[j]);
        write_data('.');
        write_data(disp[k]);
        }

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


        //----------------------------------------
        //函 數(shù) 名:reset_temp
        //函數(shù)類型:void
        //入口參數(shù):None
        //出口參數(shù):None
        //說明:復(fù)位,初始化
        //----------------------------------------
        void reset_tempt()
        {
        uint i;
        tempt=0;
        i=90;//延時
        while(i>0)i--;
        tempt=1;
        i=4;//延時
        while(i>0)i--;
        }


        //----------------------------------------
        //函 數(shù) 名:read_bit()
        //函數(shù)類型:bit
        //入口參數(shù):None
        //出口參數(shù):dat
        //說明:讀一位數(shù)據(jù)
        //----------------------------------------
        bit read_bit()
        {
        uint i;
        bit dat;
        tempt=0;
        i++;//延時
        tempt=1;
        i++;
        i++;
        dat=tempt;
        i=8;//延時
        while(i>0)i--;
        return dat;
        }


        //----------------------------------------
        //函 數(shù) 名:read_tempt()
        //函數(shù)類型:uchar
        //入口參數(shù):None
        //出口參數(shù):dat
        //說明://讀一個字節(jié)數(shù)據(jù)
        //----------------------------------------
        uchar read_tempt()
        {
        uchar i,j,dat;
        dat=0;
        for(i=1;i=8;i++)
        {
        j=read_bit();
        dat=(j7)|(dat>>1); //將讀取的數(shù)據(jù)按讀取的先后順序,從低位到高位排列保存到dat
        }
        return dat;
        }


        //----------------------------------------
        //函 數(shù) 名:write_byte()
        //函數(shù)類型:void
        //入口參數(shù):uchar dat
        //出口參數(shù):None
        //說明:寫一個字節(jié)數(shù)據(jù)到DS18B20
        //----------------------------------------
        void write_byte(uchar dat)
        {
        uint i;
        uchar j;
        bit testbit;
        for(j=1;j=8;j++)
        {
        testbit=dat0x01;//每次只寫一位數(shù)據(jù)
        dat=dat>>1;
        if(testbit)



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

        評論


        相關(guān)推薦

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

        關(guān)閉