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

<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)用 > DS18B20數(shù)字溫度計(jì)單片機(jī)接口應(yīng)用

        DS18B20數(shù)字溫度計(jì)單片機(jī)接口應(yīng)用

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

        點(diǎn)擊瀏覽下一頁(yè)

        4.實(shí)驗(yàn)任務(wù)

        用一片構(gòu)成測(cè)溫系統(tǒng),測(cè)量的溫度精度達(dá)到0.1度,測(cè)量的溫度的范圍在-20度到+100度之間,用8位數(shù)碼管顯示出來(lái)。

        5.電路原理圖

        點(diǎn)擊瀏覽下一頁(yè)

        6.系統(tǒng)板上硬件連線

        (1)把“系統(tǒng)”區(qū)域中的P0.0-P0.7用8芯排線連接到“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的ABCDEFGH端子上。

        (2)把“系統(tǒng)”區(qū)域中的P2.0-P2.7用8芯排線連接到“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的S1S2S3S4S5S6S7S8端子上。

        (3)把芯片插入“四路單總線”區(qū)域中的任一個(gè)插座中,注意電源與地信號(hào)不要接反。

        (4)把“四路單總線”區(qū)域中的對(duì)應(yīng)的DQ端子連接到“系統(tǒng)”區(qū)域中的P3.7/RD端子上。

        7.C語(yǔ)言源程序

        #include AT89X52.H>

        #include INTRINS.h>

        unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,

        0xef,0xdf,0xbf,0x7f};

        unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,

        0x66,0x6d,0x7d,0x07,

        0x7f,0x6f,0x77,0x7c,

        0x39,0x5e,0x79,0x71,0x00,0x40};

        unsigned char code dotcode[32]={0,3,6,9,12,16,19,22,

        25,28,31,34,38,41,44,48,

        50,53,56,59,63,66,69,72,

        75,78,81,84,88,91,94,97};

        unsigned char displaycount;

        unsigned char displaybuf[8]={16,16,16,16,16,16,16,16};

        unsigned char timecount;

        unsigned char readdata[8];

        sbit DQ=P3^7;

        bit sflag;

        bit resetpulse(void)

        {

        unsigned char i;

        DQ=0;

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

        DQ=1;

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

        return(DQ);

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

        }

        void writecommandtods18b20(unsigned char command)

        {

        unsigned char i;

        unsigned char j;

        for(i=0;i8;i++)

        {

        if((command 0x01)==0)

        {

        DQ=0;

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

        DQ=1;

        }

        else

        {

        DQ=0;

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

        DQ=1;

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

        }

        command=_cror_(command,1);

        }

        }

        unsigned char readdatafromds18b20(void)

        {

        unsigned char i;

        unsigned char j;

        unsigned char temp;

        temp=0;

        for(i=0;i8;i++)

        {

        temp=_cror_(temp,1);

        DQ=0;

        _nop_();

        _nop_();

        DQ=1;

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

        if(DQ==1)

        {

        temp=temp | 0x80;

        }

        else

        {

        temp=temp | 0x00;

        }

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

        }



        評(píng)論


        相關(guān)推薦

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

        關(guān)閉