版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
電子科技大學(xué)實驗報告學(xué)生姓名及學(xué)號:馬先文2011079150001朱科2011079120020指導(dǎo)教師:王子斌實驗地點:C2-110實驗時間:2014.6.10實驗室名稱:二、實驗項目名稱:脈沖波形參數(shù)的自動測試系統(tǒng)三、實驗學(xué)時:4學(xué)時四、實驗內(nèi)容:1.組建脈沖波形參數(shù)的自動測試系統(tǒng)2.設(shè)計脈沖參數(shù)測量系統(tǒng)界面2.用程控方式完成對脈沖波形參數(shù)的測量,顯示脈沖波形及參數(shù)測量結(jié)果。五、實驗結(jié)果:1、脈沖波形參數(shù)自動測試系統(tǒng)需求分析:答:函數(shù)/任意波形發(fā)生器33220A手動調(diào)節(jié)產(chǎn)生脈沖信號,信號輸出到數(shù)字示波器DSO5012A,在LabWindows/CVI集成環(huán)境下編寫脈沖參數(shù)測量控制程序,通過LXI總線控制數(shù)字示波器完成脈沖參數(shù)的測量,并在用戶界面上顯示脈沖波形及脈沖參數(shù)測量結(jié)果。2、本次實驗設(shè)計的脈沖參數(shù)測量系統(tǒng)應(yīng)用程序界面如下:3、本次實驗內(nèi)容的主體為一個程序的編制,程序的框架如下:開始開始建立儀器資源會話示波器初始化自動定標(biāo)波形采集脈沖參數(shù)測量脈沖波形顯示脈沖參數(shù)顯示關(guān)閉儀器資源會話結(jié)束4、LabWindow/CVI程序代碼如下:#include<cvirte.h> #include<userint.h>#include<visa.h>#include"PulseParameterTest.h"#defineRESOURCE"TCPIP0::192.168.1.108::inst0::INSTR"staticintpanelHandle;ViSessiondefaultRM,vi; doublepreamble[10];#defineWAVE_DATA_SIZE5000unsignedcharwaveform_data[WAVE_DATA_SIZE];voidInitialize(void);voidCapture(void);voidWaveform(void);intmain(intargc,char*argv[]){ if(InitCVIRTE(0,argv,0)==0) return-1; /*outofmemory*/ if((panelHandle=LoadPanel(0,"PulseParameterTest.uir",PANEL))<0) return-1; DisplayPanel(panelHandle); RunUserInterface(); DiscardPanel(panelHandle); return0;}intCVICALLBACKQuit(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ switch(event) { caseEVENT_COMMIT: QuitUserInterface(0); break; } return0;}intCVICALLBACKAcquire(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ charbuf[256]={0}; doubletemp; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viPrintf(vi,":MEASURE:SOURCECHAN1\n"); viQueryf(vi,":MEASURE:FREQUENCY?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_Frequency,temp); viQueryf(vi,":MEASURE:VBASE?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_Low,temp); viQueryf(vi,":MEASURE:VTOP?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_High,temp); viQueryf(vi,"MEASURE:PERIOD?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_Period,temp); viQueryf(vi,"MEASURE:VAMPLITUDE?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_Amplitude,temp); viQueryf(vi,"MEASURE:VPP?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_PTPeak,temp); viQueryf(vi,"MEASURE:RISETIME?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_RTime,temp); viQueryf(vi,"MEASURE:FALLTIME?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_FTime,temp); viQueryf(vi,"MEASURE:PWIDTH?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_PWidth,temp); viQueryf(vi,"MEASURE:NWIDTH?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_NWidth,temp); viQueryf(vi,"MEASURE:DUTYCYCLE?\n","%lf",&temp); SetCtrlVal(panelHandle,PANEL_Edt_PDutycycle,temp); Waveform(); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetPeriod(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublePeriod; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:PERIOD?CHAN1\n","%lf",&Period); SetCtrlVal(panelHandle,PANEL_Edt_Period,Period); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetTop(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doubletop; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:VTOP?CHAN1\n","%lf",&top); SetCtrlVal(panelHandle,PANEL_Edt_High,top); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetBase(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublebase; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:VBASE?CHAN1\n","%lf",&base); SetCtrlVal(panelHandle,PANEL_Edt_Low,base); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetAmplitude(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doubleamplitude; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:VAMPLITUDE?CHAN1\n","%lf",&litude); SetCtrlVal(panelHandle,PANEL_Edt_Amplitude,amplitude); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetPTPeak(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublevpp; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:VPP?CHAN1\n","%lf",&vpp); SetCtrlVal(panelHandle,PANEL_Edt_PTPeak,vpp); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetWaveform(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); Waveform(); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetFrequency(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublefrequency; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:FREQUENCY?CHAN1\n","%lf",&frequency); SetCtrlVal(panelHandle,PANEL_Edt_Frequency,frequency); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetRTime(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublertime; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:RISETIME?CHAN1\n","%lf",&rtime); SetCtrlVal(panelHandle,PANEL_Edt_RTime,rtime); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetFTime(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doubleftime; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:FALLTIME?CHAN1\n","%lf",&ftime); SetCtrlVal(panelHandle,PANEL_Edt_FTime,ftime); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetPWidth(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublepwidth; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:PWIDTH?CHAN1\n","%lf",&pwidth); SetCtrlVal(panelHandle,PANEL_Edt_PWidth,pwidth); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetNWidth(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doublenwidth; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:NWIDTH?CHAN1\n","%lf",&nwidth); SetCtrlVal(panelHandle,PANEL_Edt_NWidth,nwidth); viClose(vi); viClose(defaultRM); break; } return0;}intCVICALLBACKGetPDutycycle(intpanel,intcontrol,intevent, void*callbackData,inteventData1,inteventData2){ doubledutycycle; switch(event) { caseEVENT_COMMIT: viOpenDefaultRM(&defaultRM); viOpen(defaultRM,RESOURCE,VI_NULL,VI_NULL,&vi); viClear(vi); Initialize(); Capture(); viQueryf(vi,"MEASURE:DUTYCYCLE?CHAN1\n","%lf",&dutycycle); SetCtrlVal(panelHandle,PANEL_Edt_PDutycycle,dutycycle); viClose(vi); viClose(defaultRM); break; } return0;}voidInitialize(void){ viPrintf(vi,"*RST\n"); viPrintf(vi,":AUTOSCALE\n");}voidCapture(void){ viPrintf(vi,":ACQUIRE:TYPENORMAL\n"); viPrintf(vi,":ACQUIRE:COMPLETE100\n"); viPrintf(vi,":DIGITIZECHAN1\n");}voidWaveform(void){ intwaveform_size,i; doubletime_array[WAVE_DATA_SIZE],amp_array[WAVE_DATA_SIZE]; doubleXmin,Xmax,Ymin,Ymax; DeleteGraphPlot(panelHandle,PANEL_GRAPH_Pulse,-1,VAL_IMMEDIATE_DRAW); viPrintf(vi,":WAVEFORM:FORMATBYTE\n"); viPrintf(vi,":WAVEFORM:POINTS1000\n"); viQueryf(vi,":WAVEFORM:PREAMBLE?\n","%,10lf\n",preamble); SetCtrlVal(panelHandle,PANEL_Edt_TimeBase,preamble[4]*100); SetCtrlVal(panelHandle,PANEL_Edt_Vertical,preamble[7]*32); Xmin=(0.0-preamble[6])*preamble[4]+preamble[5]; Xmax=(1000.0-preamble[6])*preamble[4]+preamble[5]; Ymin=(0.0-preamble[9])*preamble[7]+preamble[8]; Ymax=(256.0-preamble[9])*preamble
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年粵教滬科版八年級科學(xué)上冊階段測試試卷含答案
- 保險業(yè)務(wù)老人簽約免責(zé)承諾書
- 2024年滬教版七年級語文上冊月考試卷
- 生態(tài)文明成本核算
- 2024年滬科版六年級語文上冊階段測試試卷含答案
- 2024年浙教版選修5歷史上冊月考試卷含答案
- 廣告拍攝桁架租賃合同
- 2024年北師大版選擇性必修1物理下冊階段測試試卷
- 果園設(shè)備租賃協(xié)議
- 2024年滬教版七年級語文上冊月考試卷含答案
- DB11-T 693-2024 施工現(xiàn)場臨建房屋應(yīng)用技術(shù)標(biāo)準(zhǔn)
- GB/T 45089-20240~3歲嬰幼兒居家照護(hù)服務(wù)規(guī)范
- 統(tǒng)編版2024-2025學(xué)年三年級上冊語文期末情景試卷(含答案)
- 2024年01月11344金融風(fēng)險管理期末試題答案
- 浙江省杭州市八縣區(qū)2024-2025學(xué)年高二數(shù)學(xué)上學(xué)期期末學(xué)業(yè)水平測試試題
- 紹興文理學(xué)院元培學(xué)院《操作系統(tǒng)》2022-2023學(xué)年第一學(xué)期期末試卷
- 湖南省長沙市明德教育集團(tuán)初中聯(lián)盟2020-2021學(xué)年八年級上學(xué)期期末考試地理試題
- 期末復(fù)習(xí)綜合卷(試題)-2024-2025學(xué)年一年級上冊數(shù)學(xué)人教版
- 施工員崗位述職報告
- 第47屆江蘇省選拔賽化學(xué)實驗室技術(shù)項目技術(shù)文件
- 牡丹籽油和文冠果油建設(shè)項目可行性研究報告模板備案審批
評論
0/150
提交評論