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

正文內(nèi)容

基于單片機(jī)的空調(diào)控制器設(shè)計(jì)1-資料下載頁(yè)

2025-06-20 12:43本頁(yè)面
  

【正文】 ance for the purpose of the pletion of the singlechip data acquisition, processing and display. The system is measured in the general environment to determine the value of the temperature conditions, the use of singlechip microputer to control airconditioning refrigeration and heating system to achieve the required temperature. Preliminary plan is to issue under the ordinary temperature, the system design and choice of devices is also on this basis.Key words: DS18B20 singlechip Temperature Control LED display附錄include include define uchar unsigned chardefine uint unsigned intsbit DS=P3^3。 //定義 DS18B20 接口sbit p30=P3^0。sbit p31=P3^1。sbit at=P3^4。 //定義增溫控制接口sbit dt=P3^5。 //定義減溫控制接口static int temp。 uint cout=0。static int l_tmp。uchar flag1。uint i=0。 void display(void)。 code unsigned char table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x80,0x00}。//共陰數(shù)碼管 09 空表Unsigned char l_tmpdate[8]={0,0,0,0,0,0,0,0}。 //定義數(shù)組變量,并賦值 1,2,3,4,5,6,7,8,就是本程序顯示的八個(gè)數(shù)int tmp(void)。void tmpchange(void)。void tmpwritebyte(uchar dat)。uchar tmpread(void)。bit tmpreadbit(void)。void dsreset(void)。void delayb(uint count)。void zhuti(l_tmp)。void delayc(unsigned int j)。void add(void)。void sub(void)。void ISR_EX0() interrupt 0 { delayc(2022)。 cout++。}void main() //主函數(shù){ at=1。 dt=1。 EA=1。 //首先開(kāi)啟總中斷EX0=1。 //開(kāi)啟外部中斷 0IT0=1。 // 設(shè)置成下降沿觸發(fā)方式 while(1) { tmpchange()。 //溫度轉(zhuǎn)換l_tmp=tmp()。zhuti(l_tmp)。 display()。while(cout%2!=0){ display()。 while((cout%2!=0) amp。amp。 (p31==0)) {add()。} while((cout%2!=0) amp。amp。 (p30==0)) {sub()。} } }}void delayc(uint j){ while(j0)。}void add(void){ delayc(20220)。 l_tmp=l_tmp+10。 zhuti(l_tmp)。}void sub(void){ delayc(20220)。 l_tmp=l_tmp10。 zhuti(l_tmp)。}void zhuti(int l_tmp){ l_tmpdate[0]=l_tmp/100。 l_tmp=l_tmp%100。 l_tmpdate[1]=l_tmp/10。 l_tmp=l_tmp%10。 l_tmpdate[2]=11。 l_tmpdate[3]=l_tmp。 if(((l_tmpdate[0]1)amp。amp。(l_tmpdate[1]6))|((l_tmpdate[0]2)amp。amp。(l_tmpdate[0]6)))dt=0。 else dt=1。 if(((l_tmpdate[0]2)amp。amp。(l_tmpdate[1]8))|(l_tmpdate[0]1))at=0。 else at=1。}void display(void) //顯示{ uchar i,temp。 P2=0。 P1=P1amp。0xf8。 for(i=0。i4。i++) { temp=l_tmpdate[i]。 temp=table[temp]。 P2=temp。 delayc(100)。 if(i==7)break。 P2=0。 P1++。 }}void delayb(uint count) //delay{ uint i。 while(count) { i=200。 while(i0) i。 count。 }}void dsreset(void) //DS18B20 初始化 { uint i。 DS=0。 i=103。 while(i0)i。 DS=1。 i=4。 while(i0)i。}bit tmpreadbit(void) // 讀一位{ uint i。 bit dat。 DS=0。i++。 //小延時(shí)一下 DS=1。i++。i++。 dat=DS。 i=8。while(i0)i。 return (dat)。}uchar tmpread(void) //讀一個(gè)字節(jié){ uchar i,j,dat。 dat=0。 for(i=1。i=8。i++) { j=tmpreadbit()。 dat=(j7)|(dat1)。 //讀出的數(shù)據(jù)最低位在最前面,這樣剛好 //一個(gè)字節(jié)在DAT 里 } return(dat)。 //將一個(gè)字節(jié)數(shù)據(jù)返回}void tmpwritebyte(uchar dat) { //寫一個(gè)字節(jié)到 DS18B20 里 uint i。 uchar j。 bit testb。 for(j=1。j=8。j++) { testb=datamp。0x01。 dat=dat1。 if(testb) // 寫 1 部分 { DS=0。 i++。i++。 DS=1。 i=8。while(i0)i。 } else { DS=0。 //寫 0 部分 i=8。while(i0)i。 DS=1。 i++。i++。 } }}void tmpchange(void) //發(fā)送溫度轉(zhuǎn)換命令{ dsreset()。 //初始化 DS18B20 delayb(1)。 //延時(shí) tmpwritebyte(0xcc)。 // 跳過(guò)序列號(hào)命令 tmpwritebyte(0x44)。 //發(fā)送溫度轉(zhuǎn)換命令}int tmp() //獲得溫度{ float tt。 uchar a,b。 dsreset()。 delayb(1)。 tmpwritebyte(0xcc)。 tmpwritebyte(0xbe)。 //發(fā)送讀取數(shù)據(jù)命令 a=tmpread()。 //連續(xù)讀兩個(gè)字節(jié)數(shù)據(jù) b=tmpread()。 temp=b。 temp=8。 temp=temp|a。 //兩字節(jié)合成一個(gè)整型變量。 tt=temp*。 //得到真實(shí)十進(jìn)制溫度值,因?yàn)?DS18B20 可以精確到 度,所以讀回?cái)?shù)據(jù)的最低位代表的是 度。 temp=tt*10+。 //放大十倍,這樣做的目的將小數(shù)點(diǎn)后第一位也轉(zhuǎn)換為可顯示數(shù)字,同時(shí)進(jìn)行一個(gè)四舍五入操作。 return temp。 /
點(diǎn)擊復(fù)制文檔內(nèi)容
外語(yǔ)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1