【正文】
Q = 1。 i0。 //讀取溫度寄存器等(共可讀9個寄存器) 前兩個是溫度發(fā)送指令0xbe a=ReadOneChar()。 //個位數(shù) disdata[3]=i%10。 shi=1。 display_temper(temp)。j++) 。 ADCLK=0。 ADCLK=0。 } for(i=0。//拉高數(shù)據(jù)端,回到初始狀態(tài) dat=8。i149。 { P1=i。 j+=2。s Congress that the country39。 P2=value[j+b+1]。 } } sw=1。 } for(i=0。 if(i7)ndat=1。//形成一次時鐘脈沖 _nop_()。//拉高CLK端 ADDI=(channel1)amp。 _nop_()。 for(i=0。 P0=0xff。 bai=1。 //溫度擴(kuò)大10倍,精確到1位小數(shù) return(t)。 // 跳過讀序號列號的操作 發(fā)送指令0xcc WriteOneChar(0x44)。 delay(4)。 DQ = 1。} } // 適當(dāng)延時防止因為不斷查忙而耗費(fèi)大量CUP資源 //附錄三 溫度采集程序include sbit warmer=P2^7。 init_lcd()。 max_item=menu_ledmenu_count。 measure_menu[0].parent_menus=main1_menu。 TR1=1。基于這樣的思路,我們共同完成了低功耗溫濕度檢測儀的基本設(shè)計。另外,采用盡量縮短功耗大的電路的工作時間辦法,也可以降低系統(tǒng)勘功耗。(4)、增大TA,加大采樣周期,盡量多“休息”,使系統(tǒng)的響應(yīng)變慢。 Keil C軟件介紹單片機(jī)開發(fā)中除必要的硬件外,同樣離不開軟件,我們寫的匯編語言源程序要變?yōu)镃PU可以執(zhí)行的機(jī)器碼有兩種方法,一種是手工匯編,另一種是機(jī)器匯編,目前已極少使用手工匯編的方法了。這種訪問方式不占用存儲器空間,它的接口電路與時序無關(guān),其時序完全靠軟件編程實現(xiàn)。⑸ DS1302數(shù)據(jù)輸入/輸出時序數(shù)據(jù)輸入是在輸入寫命令字的8個SCLK周期之后,在接下來的8個SCLK周期中的每個脈沖的上升沿輸入數(shù)據(jù),數(shù)據(jù)從0位開始。在此電路中,按鍵輸入端采用低電平有效,上拉電阻保證了按鍵斷開時,I/O口線有確定的高電平,(AT89C52 .P1口內(nèi)部接有上拉電阻)所以就不需要再接上拉電阻。C;芯片接口說明: 逐次逼近型是將采樣信號和已知電壓不斷進(jìn)行比較,一個時鐘周期完成1位轉(zhuǎn)換,依次類推,轉(zhuǎn)換完成后,輸出二進(jìn)制數(shù)。端口線電平和輸入輸出狀態(tài)不確定可能使外圍設(shè)備誤動作,導(dǎo)致嚴(yán)重事故的發(fā)生;內(nèi)部一些控制寄存器(專用寄存器)內(nèi)容不確定可能導(dǎo)致定時器溢出、程序尚未開始就要中斷及串口亂傳向外設(shè)發(fā)送數(shù)據(jù)。 EA/VPP外部訪問允許。此時,被外部拉低的P3口將用上拉電阻輸出電流(IIL)。 本系統(tǒng)中將該濕敏電容置于555振蕩電路中,將電容值的變化轉(zhuǎn)為與之反比的電壓頻率信號,可直接被計算機(jī)所采集。該系統(tǒng)以單片機(jī)AT89C52作為控制核心,以數(shù)字式溫度傳感器DS18B電容式濕度傳感器HS1101作為測量元件,構(gòu)成溫濕度測量系統(tǒng),同時設(shè)計了能給系統(tǒng)提供穩(wěn)定工作電壓的電源電壓。除此之外,采集到的數(shù)據(jù)是通過RS232總線上傳給工業(yè)控制計算機(jī)進(jìn)行進(jìn)一步處理的。其測量電路如下所示:( 濕度測量電路)濕度傳感器 HS1101是基于獨特工藝設(shè)計的電容元件,這些相對濕度傳感器可以大批量生產(chǎn)。P1口:P1是一個帶有內(nèi)部上拉電阻的8位雙向I/O口,P1的輸出緩沖級可驅(qū)動(吸收或輸出電流)4個TTL邏輯門電路。P3口作為一般的I/O口線外,更重要的用途是它的第二功能,如表32所示:此外,P3口還接收一些用于Flash閃速存儲器編程和程序校驗的控制信號。欲使CPU訪問外部程序存儲器(地址為 0000HFFFH),EA端必須保持低電平(接地)。因此,任何單片機(jī)在開始工作前,都必須進(jìn)行一次復(fù)位過程,使單片機(jī)處于一種確定的狀態(tài)。這類型ADC的分辨率和采樣速率是相互牽制的。 /CS 片選使能,低電平芯片使能; ?、?鍵盤抖動的消除:抖動的消除大致可以分為硬件削除抖動和軟件削抖。如果有額外的SCLK周期,它們將被忽略。本系統(tǒng)采用間接控制方式。機(jī)器匯編是通過匯編軟件將源程序變?yōu)闄C(jī)器碼,用于MCS51單片機(jī)的匯編軟件有早期的A51,隨著單片機(jī)開發(fā)技術(shù)的不斷發(fā)展,從普遍使用匯編語言到逐漸使用高級語言開發(fā),單片機(jī)的開發(fā)軟件也在不斷發(fā)展,Keil C軟件是目前最流行開發(fā)MCS51系列單片機(jī)的軟件,這從近年來各仿真機(jī)廠商紛紛宣布全面支持Keil C即可看出。 AT89C52的低功耗措施AT89C52單片機(jī)是采用CMOS工藝的低功耗8位單片機(jī)芯片,具有正常、空閑、掉電三種工作狀態(tài)。6 系統(tǒng)仿真前面已經(jīng)把單片機(jī)系統(tǒng)的硬件設(shè)計和軟件設(shè)計完成了,下一步就可以著手進(jìn)行仿真,因為在設(shè)計的過程之中肯定有許多的錯誤,需要進(jìn)行仿真來發(fā)現(xiàn)錯誤和調(diào)試錯誤。同時本設(shè)計是在Proteus上進(jìn)行仿真,在Keil C軟件上進(jìn)行編程,最后二者聯(lián)調(diào),實現(xiàn)設(shè)計任務(wù)的。 TMOD=0x11。 measure_menu[1].menu_count=2。 if (max_item=4) //菜單項為3則表示為主菜單. { for(n=0。 Disp_Img(FirstPage)。sbit led_run=P1^0。 //DQ復(fù)位 delay(8)。 } return(dat)。 // 啟動溫度轉(zhuǎn)換 發(fā)送指令0x44 Init_DS18B20()。}void display_temper(unsigned int i){ disdata[0]=i/1000。 shi=0。 P2=0xff。ic。 ADCLK=1。0x1。 _nop_()。 } ADCS=1。i16。 //顯示字符,順序是從左掃到右,有16列,數(shù)據(jù)電平是從左1到左16,由低到高 for(i=0。 delay(5)。s economic and social development of the Tenth FiveYear Plan clearly to the development of instrumentation in an important position. National Program for the Development of Instruments referred to, but in an important position, is the first time since the founding of the PRC. Shortly thereafter, the State Planning Commission, Economic and Trade Commission, Ministry of Science and Technology and many other ministries are listed a number of special, a large amount of money spent to support the development of instrumentation. In 2005, the National Development and Reform Commission issued a formal to revitalize the equipment manufacturing industry to speed up a number of opinions, the various industries in the 16 selected areas of priority to the development of specific legislation to support the development of the first of which is the 11 major projects and sophisticated automation control system testing equipment. In 2006 to develop national longterm scientific and technological development program, involves a number of control and measurement instrumentation development projects. April 2008, Ministry of Science and Technology, National Development and Reform Commission, Ministry of Education and the China Association for Science and Technology have jointly issued the innovative ways to work on strengthening a number of opinions, officially launched the work of innovative ways to carry out in the country. This paper, we explicitly put forward innovative approaches, including creative thinking, innovative approaches and innovative tools for the three elements of the main innovative tools to promote scientific and technological innovation refers to the scientific instruments. The important role of scientific instruments have been further enhanced, more powerful research and development support. In addition, 863 plans, especially in the space program and other national science and technology development plans to support the control and measurement instrumentation has also been on the development of an important position. Is in a very favorable situation, in recent years, China39。 P2=0x00。i++) //sw是154選通開關(guān)。 for(i=128。//拉低CLK端 ADDO=1。 if(i==7)dat|=ADDO。 _nop_()。 _nop_()。j10。 while(1) //主循環(huán) { temp=ReadTemperature()。 delay(150)。 //十位數(shù) disdata[2]=i%100/10。 //跳過讀序號列號的操作 WriteOneChar(0xBE)。 for (i=8。 //單片機(jī)將DQ拉低 delay(80)。 sbit zf=P2^0。 //延時//ClockMsg()。n++) { draw_bmp(n*2,20,96,0,menu_led[n].display)。 //開始測量函數(shù), 取消. measure_menu[1].subs=NULL。 TL1=0xb0。 致 謝雖然經(jīng)過大學(xué)四年的專業(yè)學(xué)習(xí),在本次畢業(yè)設(shè)計的過程中,我們?nèi)匀挥龅胶芏嚯y題,有很多是個人難以解決的。Proteus軟件由ISIS和ARES兩個軟件構(gòu)成,其中ISIS是原理圖編輯與仿真軟件,ARES是布線編輯軟件。在空閑方式下運(yùn)行時,工作電流為3mA,在掉電方式下,工作電流為50uA。運(yùn)行Keil C軟件需要Pentium或以上的CPU,16MB或更多RAM、20M以上空閑的硬盤空間、WIN9NT、WIN2000、WINXP等操作系統(tǒng)。軟件設(shè)計的部分程序見附錄 。需要注意的是,第一個數(shù)據(jù)位在命令字節(jié)的最后一位之后的第一個下降沿被輸出。②軟件削除抖動的基本原理是當(dāng)檢測出鍵盤閉合時,先執(zhí)行一個延時子程序產(chǎn)生數(shù)毫秒的延時,待接通時的前沿抖動消失后再判別是否有健按下。 CH1 模擬輸入通道1,或作為IN+/使用; ?、?由于ADC0832模數(shù)轉(zhuǎn)換器具有8位分辨率、雙通道A/D轉(zhuǎn)換、輸入輸出電平與TTL/CMOS相兼容、5V電源供電時輸入電壓在05V之間、工作頻率為250KHZ 、轉(zhuǎn)換時間為32 微秒、一般功耗僅為15MW等優(yōu)點,適合本系統(tǒng)的應(yīng)用,所以我們采用ADC083