【正文】
起著連接硬件電路與程序運(yùn)行及存儲數(shù)據(jù)的任務(wù),一方面,它將 A/D 轉(zhuǎn)換器、顯示器等通過I/O口地址線和數(shù)據(jù)線連接起來;另一方面, 它將用戶下載的程序通過控制總線控制數(shù)據(jù)的輸入輸出,從而實(shí)現(xiàn)測電壓的功能。(1) 時鐘電路STC89C52內(nèi)部有一個用于構(gòu)成振蕩器的高增益反相放大器,引腳RXD和TXD分別是此放大器的輸入端和輸出端?!?2MHz之間選擇,電容值在5~30pF之間選擇,電容值的大小可對頻率起微調(diào)的作用。RXD接地,TXD接外部振蕩器。對外部振蕩信號無特殊要求,只要求保證脈沖寬度,一般采用頻率低于12MHz的方波信號。除了進(jìn)入系統(tǒng)的正常初始化之外,當(dāng)由于程序運(yùn)行出錯或操作錯誤使系統(tǒng)處于死鎖狀態(tài)時,為擺脫困境,也需按復(fù)位鍵重新啟動。若使用頗率為6MHz的晶振,則復(fù)位信號持續(xù)時間應(yīng)超過4us才能完成復(fù)位操作。復(fù)位操作有上電自動復(fù)位相按鍵手動復(fù)位兩種方式。其中,按鍵電平復(fù)位是通過使復(fù)位端經(jīng)電阻與Vcc電源接通而實(shí)現(xiàn)的,其電路如圖34(b)所示;而按鍵脈沖復(fù)位則是利用RC微分電路產(chǎn)生的正脈沖來實(shí)現(xiàn)的,其電路如圖34(c)所示。ALE/PROG(Pin30):地址鎖存允許信號PSEN(Pin29):外部存儲器讀選通信號EA/VPP(Pin31):程序存儲器的內(nèi)外部選通,接低電平從外部程序存儲器讀指 令,如果接高電平則從內(nèi)部程序存儲器讀指令。圖35 單片機(jī)最小系統(tǒng)圖 本設(shè)計(jì)顯示器件選擇 常用顯示器件簡介本次設(shè)計(jì)中有顯示模塊,而常用的顯示器件比較多,有數(shù)碼管,LED點(diǎn)陣,1602液晶,12864液晶等。它的特點(diǎn)是顯示字跡清楚,價格相對便宜。一般1602字符型液晶顯示器實(shí)物如圖36:圖36 1602字符型液晶顯示器實(shí)物圖1) 1602LCD主要技術(shù)參數(shù):顯示容量:162個字符芯片工作電壓:—工作電流:()模塊最佳工作電壓:字符尺寸:(WH)mm2) 引腳功能說明:1602LCD采用標(biāo)準(zhǔn)的14腳(無背光)或16腳(帶背光)接口,各引腳接說明如表33所示:表33引腳接口說明表編號符號引腳說明編號符號引腳說明1VSS電源地9D2數(shù)據(jù)2VDD電源正極10D3數(shù)據(jù)3V0液晶顯示偏壓11D4數(shù)據(jù)4RS數(shù)據(jù)/命令選擇12D5數(shù)據(jù)5R/W讀/寫選擇13D6數(shù)據(jù)6E使能信號14D7數(shù)據(jù)7D0數(shù)據(jù)15A背光源正極8D1數(shù)據(jù)16K背光源負(fù)極第1腳:VSS為地電源。第5腳:R/W為讀寫信號線,高電平時進(jìn)行讀操作,低電平時進(jìn)行寫操作。第15腳:背光源正極。指令3:光標(biāo)和顯示模式設(shè)置 I/D:光標(biāo)移動方向,高電平右移,低電平左移 S:屏幕上所有文字是否左移或者右移。指令5:光標(biāo)或顯示移位 S/C:高電平時移動顯示的文字,低電平時移動光標(biāo)。指令9:讀忙信號和光標(biāo)地址 BF:為忙標(biāo)志位,高電平表示忙,此時模塊不能接收命令或者數(shù)據(jù),如果為低電平表示不忙。要顯示字符時要先輸入顯示字符地址,也就是告訴模塊在哪里顯示字符,圖35是1602的內(nèi)部顯示地址。1602液晶模塊內(nèi)部的字符發(fā)生存儲器(CGROM)已經(jīng)存儲了160個不同的點(diǎn)陣字符圖形,如圖36所示,這些字符有:阿拉伯?dāng)?shù)字、英文字母的大小寫、常用的符號、和日文假名等,每一個字符都有一個固定的代碼,比如大寫的英文字母“A”的代碼是01000001B(41H),顯示時模塊把地址41H中的點(diǎn)陣字符圖形顯示出來,我們就能看到字母“A”圖36 字符代碼與圖形對應(yīng)圖 A/D芯片常用的A/D芯片有AD0809,AD0832,LC2543C等幾種。些A/D轉(zhuǎn)換器是的特點(diǎn)是8位精度,屬于并行口,如果輸入的模擬量變化大快,必須在輸入之前增加采樣電路。 AD0832也是8位逐次逼近型A/D轉(zhuǎn)換器,并且支持雙通道A/D轉(zhuǎn)換。如果按照轉(zhuǎn)換原理劃分,主要有3種類型,即雙積分式A/D轉(zhuǎn)換器、逐次逼近式A/D轉(zhuǎn)換器和并行式A/D轉(zhuǎn)換器。 b、具有轉(zhuǎn)換起停控制端。 2)引腳功能 ADC0809芯片有28條引腳,采用雙列直插式封裝,如圖38 所示。 ADDA、ADDB、ADDC:3位地址輸入線,用與選通8路模擬輸入中的一路。 EOC: A/D轉(zhuǎn)換結(jié)束信號,輸出,當(dāng)A/D轉(zhuǎn)換結(jié)束時,此端輸出一個高電平(轉(zhuǎn)換期間一直為低電平)。要求時鐘頻率不高于640KHZ。 ADC0809的工作過程是:首先輸入3位地址,并使ALE=1,將地址存入地址鎖存器中。直到A/D轉(zhuǎn)換完成,EOC變?yōu)楦唠娖?,指示A/D轉(zhuǎn)換結(jié)束,結(jié)果數(shù)據(jù)已存入鎖存器,這個信號可用作中斷申請。 電路如圖41所示圖41 LCD顯示電路 ADC0809與單片機(jī)接口電路ADC0809具有8路模擬輸入端口,由于ADC0809內(nèi)部含有輸出三態(tài)緩沖鎖存器,所以可以直接將8位數(shù)字量輸出端與單片機(jī)P0口相連。6腳START為測試控制,當(dāng)輸入一個2us寬高電平時,就開始A/D轉(zhuǎn)換。電路如圖42所示 圖42 ADC0809與STC89C52連接圖第五章 硬件電路系統(tǒng)模塊設(shè)計(jì) 總電路模塊簡易數(shù)字電壓表應(yīng)用系統(tǒng)硬件電路由單片機(jī)、A/D轉(zhuǎn)換器、LCD顯示電路和電壓采集電路組成,它的硬件電路圖見附錄附錄IV(圖表)。7引腳為A/D轉(zhuǎn)換結(jié)束信號EOC,ADC0809為逐次比較型A/D轉(zhuǎn)換器,當(dāng)開始轉(zhuǎn)換時,EOC信號為低電平,經(jīng)過一定時間,轉(zhuǎn)換結(jié)束,轉(zhuǎn)換結(jié)束信號EOC輸出高電平,轉(zhuǎn)換的結(jié)果存放在ADC0809內(nèi)部的輸出數(shù)據(jù)鎖存器中。時鐘信號輸入端CLOCK信號的頻率為2MHZ。初始化部分包含存放通道數(shù)據(jù)的緩沖區(qū)初始化和顯示緩沖區(qū)初始化。主要流程圖如下:開始啟動A/D轉(zhuǎn)換 N A/D轉(zhuǎn)換結(jié)束? Y取數(shù)據(jù)OE=1圖62 A/D轉(zhuǎn)化測量子函數(shù)流程圖 顯示子程序顯示程序?qū)Ξ?dāng)前選中的一路數(shù)據(jù)進(jìn)行顯示。 LCD_Write_Char(5,0,39。 LCD_Write_Char(7,0,DataGo[outdata[2]])。)。 性能分析由于單片機(jī)為8位處理器,ADC0809輸出數(shù)據(jù)值為255(FFH),(5/255)。另外,可以用軟件編程來校正測量值。但設(shè)計(jì)中的不足之處仍然存在。在實(shí)際應(yīng)用工作中實(shí)用性好,測量電壓準(zhǔn)確,精度高。設(shè)計(jì)中還用到了模/數(shù)轉(zhuǎn)換芯片ADC0809,以前在學(xué)單片機(jī)課程時只是對其理論知識有了初步的理解。在以后的實(shí)踐中,我將繼續(xù)努力學(xué)習(xí)電路設(shè)計(jì)方面的理論知識,并理論聯(lián)系實(shí)際,爭取在電路設(shè)計(jì)方面能有所提升。最后,對大學(xué)四年以來曾經(jīng)關(guān)心支持過我的老師、同學(xué),特別是我的親愛的室友們送上最真誠的謝意。 Lowfrequency electrical metrology1. IntroductionIt is fundamental to take into account measurement errors when applying sampling techniques to highaccuracy digital measurements [1–3]. Reconstruction ofdeterministic,nonbandlimited, real signals from sampled values also benefit from a careful study of measurement errors [4–11].In this paper, we apply qualitative and quantitative analysis of some of error sources in sampling theory to asynchronous digital sampling measurements. We verify the significance of each error source in simulations and in laboratory measurements, and also the efficiency of errorreduction strategies. Although there are many papers that address sampling error analysis, our objective here is to study the most significant of those errors sources for electrical highaccuracy measurements.It is a mathematical idealization to assume that a signal function has limited bandwidth with finite energy and infinite duration. In practice, the signal to be sampled by an analogtodigital converter (ADC) is of limited time duration and often possesses a much wider frequency bandwidth than that of the converter. These limitations are responsible for aliasing error, one of the most significant error sources in digital sampling. Integration is another significant error source, for most ADCs average the input signal during a time interval. In addition to aliasing and integration, we also consider here two other error sources: quantization and jitter. This paper is organized as follows: in the following section, we present an introduction to sampling analysis and aliasing error. In the third section, we present an analysis of integration error in sampling systems and study a known method to pensate for it. These calculations are then applied to asynchronous data acquisition of periodical signals. In Section 4 we describe quantization and jitter errors. In Section 5 we present the conclusions.2. Sampling analysis and aliasing errorThe sampling theorem [1] states that a signal function, , defined over the field of real numbers R and square integrable over that field, with bandwidth limited to an interval radians per second, can be pletely reconstructed from its sampled values f(n),naswhere=Ts seconds is the sampling period and .Finiteduration signals do not have limited bandwidth,as stated by the uncertainty principle [12]. Therefore the signal function f(t) takes the formR[f(t)] is the aliasing error, whose norm is limited by [1] where is the Fourier transform of ,which shall be in the space of continuous real absolutely integrable functions, [1]: (5)2. 1 Aliasing error: theoretical calculationsFor signals with high harmonic distortion, the harmonic ponents’ energy can be significant even if the operational bandwidth is much larger than the fundamental frequency, Vo Hz, causing considerable aliasing error. For many reasons, evaluation of (3) is of great importance