【文章內(nèi)容簡介】
0ms()。 delay_100ms()。 delay_100ms()。 delay_100ms()。 while(1) { if(key_stop==0)//再次按下則返回 { delay_100ms()。 delay_100ms()。 delay_100ms()。 delay_100ms()。 if(key_stop==0) break。 }} EA=1。 }5 系統(tǒng)調(diào)試 系統(tǒng)調(diào)試概述本章中主要記錄和講述本超聲波測距系統(tǒng)在調(diào)試過程中錯誤的改正和功能的改進(jìn)。本章將分兩個部分進(jìn)行敘述,分別為系統(tǒng)硬件調(diào)試和和系統(tǒng)軟件調(diào)試。兩者調(diào)試的基本思想和出發(fā)點(diǎn)包含四個方面的內(nèi)容,他們分別是超聲波系統(tǒng)的測距正確性、測距精確性、系統(tǒng)穩(wěn)定性、使用方便性。這里給出本系統(tǒng)的實(shí)物圖,如下圖51所示。圖51 系統(tǒng)實(shí)物圖 硬件調(diào)試本超聲波測距系統(tǒng)的硬件電路中,除了電源模塊為模擬電路單元,其他模塊如單片機(jī)模塊、液晶顯示器模塊等均為數(shù)字單元,正因如此系統(tǒng)中大部分的數(shù)字單元,使得本系統(tǒng)工作穩(wěn)定性很高,也使得本系統(tǒng)的硬件調(diào)試相對較簡單。模擬單元電源模塊的調(diào)試:經(jīng)過測量,系統(tǒng)額定輸入電壓為9V。為系統(tǒng)提供9V電壓的是南孚9V堿性干電池,該電池在21攝氏度下,電池容量大概為400mAh到600mAh,即可保證本系統(tǒng)持續(xù)工作1個小時左右。數(shù)字單元的調(diào)試:數(shù)字單元本身具有很好的穩(wěn)定性,主要檢測各個引腳是否連接正確,各個引腳電平信號是否正確。 軟件調(diào)試本系統(tǒng)的軟件調(diào)試工具為Keil C,軟件調(diào)試的任務(wù)是使得本系統(tǒng)反應(yīng)出正確的和精確的被測距離,以及按鍵正確控制系統(tǒng)狀態(tài)切換。在本系統(tǒng)的制作中,出現(xiàn)錯誤測距時,會從程序距離計算部分,液晶顯示部分找問題。比如系統(tǒng)在調(diào)試過程中曾經(jīng)在距離數(shù)據(jù)顯示位本應(yīng)該顯示“0”“9”的數(shù)字,結(jié)果錯誤顯示“:”,調(diào)試發(fā)現(xiàn)為毫米位四舍五入程序出現(xiàn)bug,修正程序后錯誤顯示“:”的現(xiàn)象解決。程序中也進(jìn)行了顯示優(yōu)化,采用相應(yīng)程序使得高位0清空處理,使得測量者方便觀察數(shù)據(jù)。本系統(tǒng)中工作狀態(tài)切換按鍵K1曾出現(xiàn)按鍵失效狀態(tài),具體表現(xiàn)在:短按K1進(jìn)入中斷程序后,系統(tǒng)暫停工作,但再次按K1,無論是短按還是長按都不會退出中斷程序,返回工作狀態(tài)。最后在程序測試中發(fā)現(xiàn),適當(dāng)延長按鍵去抖延時就解決了此問題。6 總結(jié)基于前面章節(jié)的論述,將在本章中將指出本系統(tǒng)現(xiàn)存的不足,也進(jìn)一步提出對本系統(tǒng)改進(jìn)的構(gòu)想。具體論述從器件選擇,硬件電路、軟件設(shè)計這三個角度展開,具體分析如下。本系統(tǒng)現(xiàn)存的不足之處主要表現(xiàn)在兩個方面,即功耗過大和程序執(zhí)行效率[10]較低。首先本系統(tǒng)現(xiàn)在工作狀態(tài)額定功率約為450mw,作為一個利用干電池供電的手持?jǐn)y便設(shè)備,如果能夠?qū)⑵涔慕档偷?00mw以下,這樣可以極大的提高干電池供電時間。這里分析本系統(tǒng)功耗過大的原因?yàn)槭遣捎玫?6*2 1602ZFA字符型液晶顯示器工作功率較大,為了降低功耗可以嘗試屏幕較小,且工作電壓電流較小的液晶顯示器。其次程序效率低的原因表現(xiàn)在程序中大量引入延時程序,并且測量周期較長。改善方案可以從以下兩點(diǎn)著手:(1)將程序的顯示部分和測距部分分開,這樣可以有效的縮短測距周期。然后采另外用定時中斷定時去刷新液晶屏幕數(shù)據(jù)。(2)可以采用功能模塊較多的單片機(jī),比如具有PWM功能、輸入捕捉功能等??梢岳肞WM功能去完成超聲波發(fā)射驅(qū)動,利用輸入捕捉功能去完成時間測量,這樣可以極大的提高程序效率,同時提高測距的精度。最后提出對本系統(tǒng)的一點(diǎn)構(gòu)想,即在超聲波發(fā)射接收模塊的中間加入一支激光管。在系統(tǒng)開啟后,激光管可以發(fā)出激光束指向被測物體,那么則可用可視光路指示看不見的超聲波傳播路徑,讓測量者能夠更加清楚的觀測本超聲波測距儀與被測物體是否在一條直線上,避免一些人為的錯誤。參考文獻(xiàn)[1] 李群芳,肖看.《單片機(jī)原理、接口及應(yīng)用》.[2] 沈紅衛(wèi).《基于單片機(jī)的智能系統(tǒng)設(shè)計與實(shí)現(xiàn)》.[3] 劉海成.《單片機(jī)及應(yīng)用系統(tǒng)設(shè)計原理與實(shí)踐》.[4] 張志良.《單片機(jī)原理與控制技術(shù)》.[5] 郭速學(xué),朱承彥,郭楠.《圖解單片機(jī)功能與應(yīng)用》.[6] 樓然苗,李光飛.《[7] 張義和,陳敵北.《說例8051》.[8] 吳金戌,沈慶陽,郭庭吉.《8051單片機(jī)實(shí)踐與應(yīng)用》.[9] 許泳龍.《單片機(jī)原理及應(yīng)用》.[10] 吳國經(jīng).《單片機(jī)應(yīng)用技術(shù)》.[11] 李全利,遲榮強(qiáng).《單片機(jī)原理及接口技術(shù)》.附錄一:整體硬件電路圖附錄二:部分程序代碼:void main(void){ LcdInit()。 delay_100us()。 PutStr(0,0,now,loading)。 PutStr(0,1,waitting...)。 while(1) { sent=1。 delay_10us()。 sent=0。 delay_100us()。 TH0=0。 TL0=0。 while(receive==1)。 while(receive==0)。 TR0=1。//為高電平 ET0=1。 //定時器開始工作 while(receive==1amp。amp。flag_error==0)。 time_high=TH0。 time_low=TL0。 TR0=0。 ET0=0。 time_data=time_high*256+time_low。 time_high=0。 time_low=0。 flag_error=0。 distance_data=0。 if(time_data=26471) { time_data= (time_data*17)/100。 distance_data=time_data。 if(distance_data=4000amp。amp。distance_data=30) { display[0]=distance_data%10。 display[1]=(distance_data/10)%10。 display[2]=(distance_data/100)%10。 display[3]=(distance_data/1000)%10。 if(display[0]=5) { if(display[1]==9) { if(display[2]==9) { display[3]=display[3]+1。 display[2]=0。 display[1]=0。 } else { display[2]=display[2]+1。 display[1]=0。 } } else display[1]=display[1]+1。 } display[1]=display[1]+39。039。 display[2]=display[2]+39。039。 display[3]=display[3]+39。039。 if(display[1]==39。039。amp。amp。display[2]==39。039。amp。amp。display[3]==39。039。) { display[0]=0。 display[1]=0。 display[2]=0。 display[3]=0。 flag_error=1。 } else if(display[3]==39。039。amp。amp。display[2]!=39。039。) { display[3]=39。 39。 } else if(display[3]==39。039。amp。amp。display[2]==39。039。amp。amp。display[1]!=39。039。) { display[3]=39。 39。 display[2]=39。 39。 } } else flag_error=1。 } else flag_error=1; if(flag_error==1) { LcdWriteCmd(0x01 , 1 )。 PutStr(0,0,there is error)。 PutStr(0,1,check distance)。 flag_error=0。 EX0=0。 } else { LcdWriteCmd(0x01 , 1 )。 PutStr(0,0,the distance is:)。 PutChar(4,1,display[3])。 PutChar(5,1,display[2])。 PutChar(6,1,display[1])。 PutChar(7,1,39。 39。)。 //PutChar(8,1,display[0])。 PutChar(8,1,39。c39。)。 PutChar(9,1,39。m39。)。 EX0=1。 } }}為你提供優(yōu)秀的畢業(yè)論文參考資料,請您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!2 Many people have the same mixed feelings when planning a trip during Golden Week. With heaps of time, the sevenday Chinese為你提供優(yōu)秀的畢業(yè)論文設(shè)計參考資料,請您刪除一下內(nèi)容,O(∩_∩)O謝謝!!!National Day holiday could be the best occasion to enjoy a destination. However, it can also be the easiest way to ruin how you feel about a place and you may bee more fatigued after the holiday, due to battling the large crowds. During peak season, a dream about a place can turn to nightmare without careful planning, especially if you travel with children and older people. As most Chinese people will take the holiday to visit domestic tourist destinations, crowds and busy traffic are inevitable at most places. Also to be expected are increasing transport and acmodation prices, with the possibility that there will be no rooms available. It is also mon that you39。llwait in the line for one hour to get a ticket, and another two hours at the site, to only see a tiny bit of the place due to the crowds. Last year, 428 million tourists traveled in China over the weeklong holiday in October. Traveling during this period is a matter that needs thorough preparation. If you are short on time to plan the uping Golden Week it may not be a bad idea to avoid some of the most crowded places for now. There is always a place so fascinating that everyone yearns for. Arxan is a place like this. The beauty of Arxa