【正文】
//當(dāng)前菜單子菜單的指針 main1_menu[0].parent_menus=NULL。 //開始測量函數(shù), 取消. measure_menu[1].subs=NULL。 break。n++) { draw_bmp(n*2,20,96,0,menu_led[n].display)。 } select_item(user_choosen+1)。 //延時//ClockMsg()。 store_menu_initial()。 sbit zf=P2^0。 //4 5 6 7 8 9 unsigned int t=0。 //單片機(jī)將DQ拉低 delay(80)。i0。 for (i=8。 }delay(4)。 //跳過讀序號列號的操作 WriteOneChar(0xBE)。 t=t|a。 //十位數(shù) disdata[2]=i%100/10。 P0=0xff。 delay(150)。 delay(150)。 while(1) //主循環(huán) { temp=ReadTemperature()。 //ADC0832 k outsbit ADCLK =P3^2。j10。 ADDI=1。 _nop_()。 _nop_()。 _nop_()。i++) { dat|=ADDO。 if(i==7)dat|=ADDO。 ADCLK=0。//拉低CLK端 ADDO=1。j++) { value[(i+1)*16+j]=table[(*p0x2e)*16+j]。 for(i=128。 tra(dsw)。i++) //sw是154選通開關(guān)。 } sw=0。 P2=0x00。s control of the significant progress in recent years. First, the status of the role of As we all know, in today39。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。 my instrument control and measurement of the basic situation。 delay(5)。 P2=0x00。 //顯示字符,順序是從左掃到右,有16列,數(shù)據(jù)電平是從左1到左16,由低到高 for(i=0。 //AD轉(zhuǎn)換結(jié)果 l=k/*。i16。i++) { if(i4) //i=2時查的是句號,其他3個是電壓值 { for(j=0。 } ADCS=1。 _nop_()。 _nop_()。 for(i=0。0x1。0x1。 ADCLK=1。 if(channel==0)channel=2。ic。 //ADC0832 chip seclectsbit ADDI =P3^3。 P2=0xff。 dots=0。 shi=0。 P0=tflag。}void display_temper(unsigned int i){ disdata[0]=i/1000。 //低位右移4位,舍棄小數(shù)部分 //t=b4。 // 啟動溫度轉(zhuǎn)換 發(fā)送指令0x44 Init_DS18B20()。 DQ = 1。 } return(dat)。unsigned char dat = 0。 //DQ復(fù)位 delay(8)。sbit DQ =P3^3。sbit led_run=P1^0。 main_menu_initial()。 Disp_Img(FirstPage)。nmax_item。 if (max_item=4) //菜單項為3則表示為主菜單. { for(n=0。 } shuaxin=1。 measure_menu[1].menu_count=2。 //定義一個開始測量數(shù)組// main1_menu[0].subs=NULL。 TMOD=0x11。感謝指導(dǎo)老師,在他的指導(dǎo)下,我們對本次設(shè)計有了深刻的認(rèn)識和了解,更好的掌握了學(xué)習(xí)和設(shè)計的方法,同時他還給我們提供了大量的學(xué)習(xí)參考資料,教會我們?nèi)绾螐闹R的海洋中檢索到我們想要的知識,他對學(xué)習(xí)的嚴(yán)謹(jǐn)態(tài)度也給我們做了良好的榜樣。同時本設(shè)計是在Proteus上進(jìn)行仿真,在Keil C軟件上進(jìn)行編程,最后二者聯(lián)調(diào),實現(xiàn)設(shè)計任務(wù)的。軟件是基于C語言編寫的,結(jié)合C語言編寫語言的優(yōu)點,使我們的編寫具有很好的可控性、模塊化和移植性。6 系統(tǒng)仿真前面已經(jīng)把單片機(jī)系統(tǒng)的硬件設(shè)計和軟件設(shè)計完成了,下一步就可以著手進(jìn)行仿真,因為在設(shè)計的過程之中肯定有許多的錯誤,需要進(jìn)行仿真來發(fā)現(xiàn)錯誤和調(diào)試錯誤。單片機(jī)的功耗隨主振頻率的提高而增加,頻率越高,CMOS管處于放大區(qū)的時間越長,功耗就越大。 AT89C52的低功耗措施AT89C52單片機(jī)是采用CMOS工藝的低功耗8位單片機(jī)芯片,具有正常、空閑、掉電三種工作狀態(tài)。5 系統(tǒng)低功耗設(shè)計 設(shè)計思路系統(tǒng)設(shè)計的總體思路是圍繞如何實現(xiàn)低功耗展開。機(jī)器匯編是通過匯編軟件將源程序變?yōu)闄C(jī)器碼,用于MCS51單片機(jī)的匯編軟件有早期的A51,隨著單片機(jī)開發(fā)技術(shù)的不斷發(fā)展,從普遍使用匯編語言到逐漸使用高級語言開發(fā),單片機(jī)的開發(fā)軟件也在不斷發(fā)展,Keil C軟件是目前最流行開發(fā)MCS51系列單片機(jī)的軟件,這從近年來各仿真機(jī)廠商紛紛宣布全面支持Keil C即可看出。前者可在相當(dāng)程度上得到實物演示實驗的效果,后者則是實物演示實驗難以達(dá)到的效果。本系統(tǒng)采用間接控制方式。該型號顯示器消耗電量比較低,可以滿足系統(tǒng)要求。如果有額外的SCLK周期,它們將被忽略。而通信時,僅需要3個口線:(1)RES(復(fù)位),(2)I/O數(shù)據(jù)線,(3)SCLK(串行時鐘)。⑶ 鍵盤抖動的消除:抖動的消除大致可以分為硬件削除抖動和軟件削抖。其內(nèi)部電源輸入與參考電壓的復(fù)用,使得芯片的模擬電壓輸入在05V之間。 /CS 片選使能,低電平芯片使能; 工作頻率為250KHZ,轉(zhuǎn)換時間為32us;( 模數(shù)轉(zhuǎn)換電路圖)這類型ADC的分辨率和采樣速率是相互牽制的。本設(shè)計中復(fù)位電路采用的是開關(guān)復(fù)位電路,開關(guān)S9未按下是上電復(fù)位電路,上電復(fù)位電路在上電的瞬間,由于電容上的電壓不能突變,電容處于充電(導(dǎo)通)狀態(tài),故RST腳的電壓與VCC相同。因此,任何單片機(jī)在開始工作前,都必須進(jìn)行一次復(fù)位過程,使單片機(jī)處于一種確定的狀態(tài)。 單片機(jī)最小系統(tǒng)的實現(xiàn)介紹完以上的單片機(jī)系統(tǒng)的核心芯之后,我們采用AT89C52來實現(xiàn)一個單片機(jī)系統(tǒng)能運行起來的需求最小的系統(tǒng),電路圖如下所示:( 單片機(jī)的最小系統(tǒng)圖)上圖由晶振電路和復(fù)位電路,AT89C52芯片組成,構(gòu)成最小的單片機(jī)系統(tǒng), 下面詳細(xì)介紹其中的兩個電路。欲使CPU訪問外部程序存儲器(地址為 0000HFFFH),EA端必須保持低電平(接地)。(表32 P3口第二功能)端口引腳第二功能RXD(串行輸入口)TXD(串行輸出口)INT0(外中斷0)INT1(外中斷1)T0(定時/計數(shù)器0)T1(定時/計數(shù)器1)WR(外部數(shù)據(jù)存儲器寫選通)RD (外部數(shù)據(jù)存儲器讀選通) 對Flash存儲器編程器件,改引腳還用于輸入編程脈沖(PROG)。P3口作為一般的I/O口線外,更重要的用途是它的第二功能,如表32所示:此外,P3口還接收一些用于Flash閃速存儲器編程和程序校驗的控制信號。 在訪問外部程序存儲器或16位地址的外部數(shù)據(jù)存儲器(例如執(zhí)行MOVDPTR指令)時,P2口送出高8位地址數(shù)據(jù)。P1口:P1是一個帶有內(nèi)部上拉電阻的8位雙向I/O口,P1的輸出緩沖級可驅(qū)動(吸收或輸出電流)4個TTL邏輯門電路。AT89C52的引腳圖如下所示:( AT89C52的引腳圖)AT89C52引腳功能:其測量電路如下所示:( 濕度測量電路)濕度傳感器 HS1101是基于獨特工藝設(shè)計的電容元件,這些相對濕度傳感器可以大批量生產(chǎn)。電路圖如下:( 溫度測量電路)一、DS18B20單片機(jī)的技術(shù)性能描述 1. 獨特的單線接口方式,DS18B20