【正文】
scanning speed set at the level of s / div, displayed on the oscilloscope 5 grid。 input signal frequency set at 10 khz, the level of the scanning speed in the 20 us / div , The oscilloscope show the 5 grid. Two measurements are also indicators of demand. (3) input noise measurements: the input termination, in the oscilloscope measured the level of scanning lines the width of about 3 mv.. So virtual instrument technology are puters, measuring instruments, the rapid development of software technology and integration and 孕育 out a new technology. Virtual instrument technology is the core of the powerful use of puter resources so that the necessary hardware to achieve the technology and software to minimize system cost, enhance system functionality and flexibility, pared with the electronic devices have great advantages. The virtual digital oscilloscope on the design and implementation of the principle, the use of VB programming, data collection, such as through the use of hardware, achieving a doubletrace oscilloscope features, dualchannel display, measuring the voltage input signal, the frequency of cycles and storage, and other signals. The virtual puter equipment is the intelligent electronic measuring instruments. Virtual instrument through dedicated hardware and software modules constitute a good humanputer interface, users can customize the testing capabilities and to enable the measurement object diversification. Virtual machines external interface through the data acquisition card after the signal sent to puter data acquisition, plex testing, data analysis and results are pleted entirely by puter software. A good performance of the virtual instrument can be achieved not only the most traditional instrument measurements, in many ways than the traditional instruments are inparable advantages, such as the use of flexible, testing, featurerich, low prices, such as the use of a machine, which makes Virtual machines bee the future development of electronic measuring instruments in the direction even broader. The final design of a graphical programming language LabVIEW and objectoriented programming techniques, in order to increase its spectrum analysis can not only observe that wave, also can enter data for analysis. Collection of data entered the store, measuring results and waveforms can directly input and output (or Dupan archiving). Played a powerful puter dataprocessing capabilities and software design flexibility. 虛擬數(shù)字存儲(chǔ)示波器 虛擬數(shù)字存儲(chǔ)式示波器的結(jié)構(gòu)與組成:虛擬數(shù)字示波器由一塊 PXI總線的多功能數(shù)據(jù)采集卡和相應(yīng)的軟件組成。將它們安裝在一臺(tái)運(yùn)行 Windows 的 PC上,即構(gòu)成一個(gè)功能強(qiáng)大的可存儲(chǔ)數(shù)字示波器。 數(shù)據(jù)采集卡 設(shè)計(jì)中所采用的是 NI公司生產(chǎn)的多功能數(shù)據(jù)采集卡 PXI6670E,其主要功能如下: 64路單端 /32路差分模擬輸入; 12位精度; 采樣速度; 磁盤(pán) 寫(xiě)入速度;177。 ~177。 10V 輸入范圍;兩路 12 位模擬輸出; 8 條數(shù)字 I/O 線;兩路 24 位計(jì)數(shù)器 /定時(shí)器。 儀器功能: 虛擬數(shù)字示波器具有實(shí)時(shí)數(shù)據(jù)采集、頻譜分析、加窗處理和濾波等功能。在虛擬數(shù)字示波器主面板上有數(shù)據(jù)采集、頻譜分析、加窗處理、濾波功能等功能鍵,按相應(yīng)的功能鍵就可進(jìn)入相應(yīng)的子面板。 軟件的設(shè)計(jì)與實(shí)現(xiàn): 虛擬數(shù)字示波器軟件設(shè)計(jì)采用了基于 C 語(yǔ)言的編程環(huán)境 LabWindows/CVI。LabWindows/CVI 支持?jǐn)?shù)值型、布爾型、文本型和串等數(shù)據(jù)類(lèi)型,而且最大優(yōu)點(diǎn)是能夠通過(guò)對(duì)話框形式的交互式操作生成 標(biāo)準(zhǔn) C程序代碼。另外 LabWindows/CVI 提供了非常豐富的調(diào)試工具 ,包括單步執(zhí)行、斷點(diǎn)、變量查看、監(jiān)視窗口等,這些功能使程序的調(diào)試變 得更為容易。 主要功能模塊: 虛擬數(shù)字示波器主要由軟件控制完成信號(hào)的采集和顯示處理,在數(shù)據(jù)采集面板中主要完成以下功能:設(shè)置通道、設(shè)置采樣頻率、設(shè)置產(chǎn)生方式、顯示波形等,在數(shù)據(jù)采集面板中主要完成以下功能:對(duì)實(shí)時(shí)采集的信號(hào)和自行產(chǎn)生的信號(hào)進(jìn)行頻譜分析,查看譜線等功能,加窗處理面板對(duì)實(shí)時(shí)采集的信號(hào)和自行產(chǎn)生的信號(hào)加窗處理 (包括海明窗、漢明窗、平滑窗和布拉克曼窗等 )。在濾波處理 面板中包括以下功能:對(duì)實(shí)時(shí)采集的信號(hào)和自行產(chǎn)生的信號(hào)進(jìn)行濾波處理 (包括單步濾波法、多步濾波法和傳統(tǒng)方法等 ). 源程序文件的生成: 當(dāng)完成面板各個(gè)控件的設(shè)置后,就可以產(chǎn)生程序的代碼函數(shù)了。具體方法為:把已完成的面板定為當(dāng)前響應(yīng)狀態(tài),在 [Code]菜單中,選中 [Generate]中的 [All Code],在彈出的對(duì)話框中選定函數(shù)主面板和退出函數(shù),就能產(chǎn)生與用戶接口文件相對(duì)應(yīng)的框架代碼函數(shù)。 添加程序代碼: 上一步自動(dòng)生成的是控件對(duì)應(yīng)的函數(shù)的框架,要使控件完成一定的功能,必須添加程序代碼來(lái)控制控件。其中 main()函數(shù)是程序的入口,它的功能是初始化程序,裝載用戶面板并顯示,如要完成其他功能須添加代碼。以下這段代碼實(shí)現(xiàn)數(shù)據(jù)采集功能,程序通過(guò)調(diào)用數(shù)據(jù)采集按鈕的回調(diào)函數(shù) SHOU進(jìn)行外部采集。 軟件開(kāi)發(fā)環(huán)境 :虛擬數(shù)字示波器軟件設(shè)計(jì)采用了基于 C 語(yǔ)言的編程環(huán)境 LabWindows/CVI。LabWindows/CVI 支持?jǐn)?shù)值型、布爾型、文本型和串等數(shù)據(jù)類(lèi)型,而且最大優(yōu)點(diǎn)是能夠通過(guò)對(duì)話框形式的交互式操作生成標(biāo)準(zhǔn) C程序代碼。另外 LabWindows/CVI 提供了非常豐富的調(diào)試工具 ,包括單步執(zhí)行、斷點(diǎn)、變量查看、監(jiān)視窗口等,這些功能 使程序的調(diào)試變 得更為容易。 另外虛擬示波器相比傳統(tǒng)示波器具有價(jià)格低廉、功能豐富、可編程性以及顯示直觀等眾多優(yōu)勢(shì)。本設(shè)計(jì)不僅僅具有示波器基本功能,更依據(jù) LabVIEW 語(yǔ)言的特點(diǎn)豐富了數(shù)字濾波、信號(hào)保存以及回顯等功能。不僅具有了價(jià)格低廉、界面美觀等特點(diǎn),而且具有傳統(tǒng)示波器中比較高端的存儲(chǔ)、回顯以及數(shù)字濾波等功能,更可以根據(jù)需要隨時(shí)靈活修改程序,增加功能以滿足更個(gè)性化的要求。 具備功能: ★實(shí)時(shí)顯示:通過(guò)采集卡采集信號(hào)并能對(duì)輸入信號(hào)實(shí)時(shí)顯示在 PC 機(jī)終端上。 ★數(shù)字濾波:采用數(shù)字 IIR 濾波器對(duì)信號(hào)進(jìn)行濾波處理并實(shí) 時(shí)顯示,同時(shí)可以任意設(shè)置濾波器的最佳逼近函數(shù)類(lèi)型、濾波器類(lèi)型、階次、上下截止頻率等參數(shù)。 ★截波顯示:即可滿足波形的瞬態(tài)顯示,同時(shí)也可以將瞬態(tài)波形進(jìn)行保存。 ★波形存儲(chǔ):可隨時(shí)將原始信號(hào)或處理后信號(hào)以 LabVIEW 特有的 LVM 文件格式存儲(chǔ)在本地硬盤(pán)上,便于日后分析或處理。其中瞬態(tài)信號(hào)在截波后以 BMP圖片格式存儲(chǔ)在本地硬盤(pán)上供日后查看以及分析。 ★波形回顯:隨時(shí)將存儲(chǔ)的 LVM格式波形文件重新讀取然后顯示在 PC 機(jī)端。 ★頻譜分析:對(duì)濾波后信號(hào)分別進(jìn)行幅頻相應(yīng)分析以及相頻響應(yīng)分析并同時(shí)采取波形與表格方式實(shí)時(shí)顯示 . 基本原理 : 硬件上利用采集卡采集信號(hào),軟件上利用 NI 提供的 DAQmx READ 采集信號(hào),然后通過(guò)Waveform Graphs 進(jìn)行實(shí)時(shí)顯示。這就實(shí)現(xiàn)了一個(gè)最基本的示波器,信號(hào)顯示后又利用 Write To Measurement File將波形保存為 LVM文件。這就實(shí)現(xiàn)了基本的“存儲(chǔ)”功能,反之通過(guò)Read To Measurement File 可以將 LVM讀取顯示,從而完成“回顯”功能。 由于在硬件上是以 PC機(jī)以及采集卡為基礎(chǔ)的,所以本示波器在采樣極限速率,帶寬,分辨力等參數(shù)上受到限制。而程序響應(yīng)時(shí)間上則 依賴于 PC的配置以及程序的執(zhí)行效率 主要的函數(shù): DAQmx Read、 Digital IIR Filter、 Waveform Graphs、 Write To Measurement File、Read To Measurement File 等主要函數(shù) 定制波形圖: 波形圖顯示了兩個(gè)信號(hào)。為了區(qū)分縮放信號(hào)的曲線和模擬信號(hào)的曲線, 您需要定制曲線繪制。完成下面的步驟可以定制在前面板內(nèi)顯示件的外觀。 1. 移動(dòng)光標(biāo)至波形圖中的曲線圖例頂部。 注意在圖表中有兩個(gè)曲線,在曲線圖例中卻只顯示了一條曲線。 2. 當(dāng)雙向 箭頭出現(xiàn)時(shí),如圖 111,點(diǎn)擊并拖曳曲線圖例的邊框直到出 現(xiàn)第二條曲線名字。 3. 右擊波形圖,從快捷菜單中單擊 Properties,顯示出 Graph Properties 對(duì)話框。 4. 在 Plots 標(biāo)簽內(nèi),從下拉菜單中選擇 Sawtooth。點(diǎn)擊 Line Color 調(diào)色盒顯示出顏色拾取工具,并選擇一個(gè)新的線條顏色。 5. 從下拉菜單中選擇 Sawtooth(Scaled)。 6. 選中 Don’t use waveform names for plot names 復(fù)選框。 7. 在 Name 文本框內(nèi), 刪除現(xiàn)在的標(biāo)記,改變?cè)摋l曲線的名字為 Scaled Sawtooth。 8. 點(diǎn)擊 OK 按鈕,應(yīng)用當(dāng)前的配置,并關(guān)閉 Graph Properties 對(duì)話 框。 注意 : 在前面板內(nèi)的曲線顏色發(fā)生了改變。 9. 利用 Graph Properties 對(duì)話框試驗(yàn)圖表的其它屬性。例如,在 Scales 標(biāo)簽內(nèi),禁用自動(dòng)縮放功能。 10. 當(dāng)您試驗(yàn)時(shí),點(diǎn)擊 Cancel 按鈕可以使您改變的設(shè)置無(wú)效。如果應(yīng) 用您改變的設(shè)置,則點(diǎn)擊 OK 按鈕。 11. 保存并關(guān)閉該 VI 程序。 用戶控制下的存儲(chǔ)數(shù)據(jù): 完成下面的步驟,來(lái) 創(chuàng)建一個(gè) VI 程序,當(dāng)用戶點(diǎn)擊前面板的一個(gè)按鈕時(shí), 把數(shù)據(jù)存入一個(gè)文件。 1. 在程序框圖上,雙擊 Write LabVIEW Measurement File Express VI 來(lái)打開(kāi) Configure Write LabVIEW Measurement File 對(duì)話框。 2. 把 File name 文本框中的文件名 改變?yōu)?Selected ,使數(shù)據(jù)存入一個(gè)不同的文件。 3. 關(guān)閉 Configure Write LabVIEW Measurement File 對(duì) 話框。 4. 右擊 Write L