<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > DS18B20 數字溫度傳感程序

DS18B20 數字溫度傳感程序

作者: 時(shí)間:2016-11-29 來(lái)源:網(wǎng)絡(luò ) 收藏
////////////////////////////////////////////////////////////////////*名稱(chēng):單片機讀取DS18b20時(shí)鐘芯片                                  //*作者:周光明                                                    //*時(shí)間:2010年12月6日                                             //*功能:                                                          //*                                                                //*                                                                ////////////////////////////////////////////////////////////////////*/#include #define uchar unsigned char#define uint unsigned intsbit DQ=P2^3;bit SIGN_FLAG;////////////////////////void yanshids18b20(uint t){while(t--);}//////////////////////////初始化chushids18b20(){uchar dushu=0;DQ=1;yanshids18b20(8);DQ=0;yanshids18b20(80);DQ=1;yanshids18b20(14);dushu=DQ;yanshids18b20(60);return(dushu);}////////////////////////讀一個(gè)字節duds18b20(){uchar i,j;uchar temp=0;for(i=0;i<8;i++){DQ=0;temp>>=1;DQ=1;for(j=0;j<3;j++);if(DQ)temp|=0x80;yanshids18b20(4);}return(temp);}/////////////////////////寫(xiě)一個(gè)字節xieds18b20(uchar shuju){uchar i;for(i=0;i<8;i++){DQ=0;DQ=shuju&0x01;yanshids18b20(5);DQ=1;shuju>>=1;}yanshids18b20(1);}///////////////////////////////啟動(dòng)溫度轉換qidongds18b20(){chushids18b20();if(~chushids18b20()){xieds18b20(0xcc);xieds18b20(0x44);}}/////////////////////////讀取溫度duquds18b20(){uchar c1,c2;uchar temp1,temp2,temp3;float tt=0;chushids18b20();xieds18b20(0xcc);xieds18b20(0xbe);c1=duds18b20();c2=duds18b20();temp1=c1>>4;temp2=c2<<4;temp3=temp1+temp2;if(temp2&0x80){temp3=256-temp3;SIGN_FLAG=1;}else SIGN_FLAG=0;return(temp3);}/////////////////////////////////////


關(guān)鍵詞: DS18B20數字溫度傳

評論


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

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>