【正文】
......... 29 1. 硬件調(diào)試 ..................................................................................................................... 29 2. 軟件調(diào)試 ..................................................................................................................... 30 十.總結(jié) ........................................................................................................................................ 30 參考文獻(xiàn) ........................................................................................................................................ 31 3 一.?dāng)?shù)字電壓表簡介: 數(shù)字電壓表出現(xiàn)在 50年代初, 60年代末發(fā) 起來的電壓測量儀表, 簡稱 DVM,它采用的是數(shù)字化測量技術(shù),把連續(xù)的模擬量,也就是連續(xù)的電壓值轉(zhuǎn)變?yōu)椴贿B續(xù)的數(shù)字量,加以數(shù)字處理然后再通過顯示器件顯示。它的具體功能是:最高量程為 200V,分三個(gè)檔位量程,即 2V, 20V, 200V,可以通過調(diào)檔開關(guān)來實(shí)現(xiàn)各個(gè)檔位。 如今,數(shù)字電壓表已絕大部分已取代了傳統(tǒng)的模擬指針式電壓表。 目前實(shí)現(xiàn)電壓數(shù)字化測量的方法仍然模 數(shù)( A/D)轉(zhuǎn)換的方法。其中,電壓量的測量最為經(jīng)常。其中, A/D轉(zhuǎn)換器是它的核心器件,它將輸入的模擬量轉(zhuǎn)換成數(shù)字量。由于單片機(jī)的發(fā)展已經(jīng)成熟,利用單片機(jī)系統(tǒng)的軟硬件結(jié)合,可以組裝出許多的應(yīng)用電路來。 6 單片機(jī)是指一個(gè)集成在一塊芯片上的完整計(jì)算機(jī)系統(tǒng),具有一個(gè)完整計(jì)算機(jī)所需要的大部分部件: CPU,內(nèi)存,總線系統(tǒng)等。 綜合以上各種單片機(jī)的基本性能及本設(shè)計(jì)的滿足需要,我 們將選擇 51系列單片機(jī)。這也是數(shù)碼管的不足之處。 12864液晶也是一種工業(yè)字符 型液晶,它不僅能夠顯示 1602液晶所可以顯示的字符,數(shù)字等信息,而且還可以顯示 8*4 個(gè)中文漢字和一些簡單的圖片,顯示信息也非常的清楚。因此,在本設(shè)計(jì)實(shí)驗(yàn)我們選擇 1602液晶顯示器件。 顯示模式設(shè)置 指令碼 功能 0 0 1 1 1 0 0 0 設(shè)置 16*2顯示, 5*7點(diǎn)陣, 8位數(shù)據(jù)口 顯示開 /關(guān)及光標(biāo)設(shè)置 指令碼 功能 0 0 0 0 1 D C B D=1 開顯示; D=0關(guān)顯示 C=1 顯示光標(biāo); C=0不顯示關(guān)標(biāo) B=1 光標(biāo)閃爍; B=0光標(biāo)不顯閃爍 0 0 0 0 0 1 N S N=1 當(dāng)讀寫一個(gè)字條款后地址指針加一,且光標(biāo)加一。 AD0809 是 8 位逐次逼近型 A/D 轉(zhuǎn)換器,它是由一個(gè) 8 路的模擬 開關(guān)、一個(gè)地址鎖存譯碼器、一個(gè) A/D 轉(zhuǎn)換器和一個(gè)三態(tài)輸出鎖存器組成 。 綜合上述幾種 A/D轉(zhuǎn)換芯片的特點(diǎn),前兩種芯片的性能和精度都不如第 三種芯片。 各引腳的使用詳細(xì)介紹。 CS一旦有效,按照前一次轉(zhuǎn)換結(jié)果的 MSB/LSB 值將 data out從高阻抗?fàn)顟B(tài)轉(zhuǎn)變成相應(yīng)的邏輯電平, I/O clk 的下一個(gè)下降沿將根據(jù)下一個(gè) MSB/LSB 將 data out驅(qū)動(dòng)成相應(yīng)的邏輯電平,剩下的各位依次移出。 8. REF+端通常接 VCC,最大輸入電壓范圍取決于加于本端與加于 REF端的電壓差。 2.設(shè)計(jì)方案: 根據(jù)上述,我們選擇單片機(jī)與 A/D轉(zhuǎn)換芯片結(jié)合的方法實(shí)現(xiàn)本設(shè)計(jì)。 則完整輸入電路如下: 16 通過計(jì)算, 可知設(shè)計(jì)衰減器用的電阻 R2, R3和 R4分別為 : 9M, 900K, 100K控制檔 位的開關(guān)是雙開關(guān)的 , 目地是能夠使單片機(jī) CPU自動(dòng)識別檔位,即可用相應(yīng)的檔位的數(shù)據(jù)轉(zhuǎn)換的算法計(jì)算出正確的電壓值。原理圖如下所示。 由于現(xiàn)在單片機(jī)的發(fā)展已經(jīng)達(dá)到了很高的水平,內(nèi)部的各種資源相當(dāng)?shù)呢S富, CPU的處理速度非常的快。 主程序的總體流程如下圖: 全部軟件程序如下: include define uchar unsigned char define uint unsigned int define key_state0 0 //鍵盤掃描的各個(gè)狀態(tài) 開始 對液晶,定時(shí)器初始化 A/D 轉(zhuǎn)換 數(shù)據(jù)轉(zhuǎn)換 顯示瞬時(shí)電壓值 鍵盤判斷 顯示 5 秒的平均電壓值 3 秒后清屏 20 define key_state1 1 define key_state2 2 define key_state3 3 sbit rs=P1^2。 sbit flag_1=P2^1。//平均電壓值標(biāo)志符 uchar t。 P0=。 ep=1。 delay(1)。 IE=0x82。 } add=add+y。 write_dat(a[2]+0x30)。break。 str++。i++) 25 { con_way=1。 } cs=1。//一檔 ,量程 2V return dat_v。 break。 delay(10)。 } read_key()。 dat_aver=(dat1+dat2+dat3+dat4+dat5)/5。//重新放入初始值 TL0=(6553650000)%256。 2. 軟件調(diào)試 軟件調(diào)試的任務(wù)是利用開發(fā)工具進(jìn)行在線仿真調(diào)試,發(fā)現(xiàn)和糾正程序的錯(cuò)誤,同時(shí)也能發(fā)現(xiàn)硬件的故障。 2) 檢查按鍵模塊程序。則數(shù)據(jù)轉(zhuǎn)換的算法正確的。因?yàn)槠綍r(shí)所需要測量的被測電壓的電壓值不是一個(gè)定值,多多少少都有一些微小的變化。不能以元器件 是否是最高性能作為選擇元器件的標(biāo)準(zhǔn)。 參考文獻(xiàn) 1) 陳洪中。s 150th anniversary celebrations and will attend City39。或許是愧疚于自己似乎把轉(zhuǎn)瞬即逝的很多個(gè)不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏。t remember his appearance. 童年時(shí),覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進(jìn),會越來越發(fā)現(xiàn),那些東西根本就可有可無;初中時(shí),以為要有一場暗戀才意味著真正的成長,但三年過去后,自己心平氣和的寫同學(xué)錄的時(shí)候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個(gè)句點(diǎn),但畢業(yè)晚會的時(shí)候最終還是被梗塞在了咽喉,后來再次站在他曾經(jīng)揮汗如雨的球場,看著他投過籃球的球 框時(shí),突然間發(fā)現(xiàn)自己已經(jīng)想不起他的容顏。 34 At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt。s not needed. Instead, he plans to deploy his 270squarefoot (25squaremeter) main chute at an altitude of around 5,000 feet (1,524 meters). In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds. Even if everything goes as planned, it won39。t start planning... Those years, those days of do, finally, like youth, will end in our life. 此刻,天空是陰暗的,空氣里有著剛下過雨之后的清新因子。想要的,不想要的,界限明確,好像沒有什么可以撼動(dòng)自己。 Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isn39。s governing body, has also ordered an immediate investigation into the referee39。t appealed against the disciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any pensation awarded to you as a result of your failure to appeal. Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are plaining about happened. If your application is received after this time limit, the tribunal will not usually accept it. If you are worried about how the time limits apply to you, take advice from one of the anisations listed under Further help. Employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation. Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the anisations listed under Further help. If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their