freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于stc89c51rc和ds18b20的簡單數(shù)字溫度計(編輯修改稿)

2025-07-21 15:55 本頁面
 

【文章內(nèi)容簡介】 電平,為讀0。讀時間片的最短持續(xù)期限為60uS,各讀時間片之間必須有最短為1uS的恢復(fù)時間。開始初始化P0口、P2口:P0用于數(shù)碼管段選數(shù)據(jù)傳送 P2用于數(shù)碼管位選數(shù)據(jù)傳送設(shè)置3個變量,用以存儲讀取的3位溫度數(shù)據(jù)單片機發(fā)送指令使DS18B20開始溫度轉(zhuǎn)換稍作延時等待轉(zhuǎn)換完成從DS18B20讀取測得溫度數(shù)據(jù)溫度數(shù)據(jù)轉(zhuǎn)換為數(shù)碼管顯示碼數(shù)據(jù)送數(shù)碼管顯示圖三:程序流程圖程序設(shè)計clude define uchar unsigned chardefine uint unsigned intsbit DS=P2^2。 //define interfaceuint temp。 // variable of temperatureuchar flag1。 // sign of the result positive or negativesbit dula=P2^6。sbit wela=P2^7。unsigned char code table[]={0x3f,0xin 06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}。unsigned char code table1[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd, 0x87,0xff,0xef}。void delay(uint count) //delay{ uint i。 while(count) { i=200。 while(i0) i。 count。 }}///////功能:串口初始化,波特率9600,方式1///////void Init_Com(void){ TMOD = 0x20。 PCON = 0x00。 SCON = 0x50。 TH1 = 0xFd。 TL1 = 0xFd。 TR1 = 1。}void dsreset(void) //send reset and initialization mand 18B20復(fù)位,初始化函數(shù){ uint i。 DS=0。 i=103。 while(i0)i。 DS=1。 i=4。 while(i0)i。}bit tmpreadbit(void) //read a bit 讀1位數(shù)據(jù)函數(shù){ uint i。 bit dat。 DS=0。i++。 //i++ for delay DS=1。i++。i++。 dat=DS。 i=8。while(i0)i。 return (dat)。}uchar tmpread(void) //read a byte date 讀1字節(jié)函數(shù){ uchar i,j,dat。 dat=0。 for(i=1。i=8。i++) { j=tmpreadbit()。 dat=(j7)|(dat1)。 //讀出的數(shù)據(jù)最低位在最前面,這樣剛好一個字節(jié)在DAT里 } return(dat)。}void tmpwritebyte(uchar dat) //write a byte to ds18b20 向1820寫一個字節(jié)數(shù)據(jù)函數(shù){ uint i。 uchar j。 bit testb。 for(j=1。j=8。j++) { testb=datamp。0x01。 dat=dat1。 if(testb) //write 1 { DS=0。 i
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1