版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
電子科技大學(xué)實(shí)驗(yàn)報(bào)告學(xué)生姓名及學(xué)號(hào):馬先文2011079150001朱科2011079120020指導(dǎo)教師:王子斌實(shí)驗(yàn)地點(diǎn):C2-110實(shí)驗(yàn)時(shí)間:2014.6.10實(shí)驗(yàn)室名稱:二、實(shí)驗(yàn)項(xiàng)目名稱:脈沖波形參數(shù)的自動(dòng)測(cè)試系統(tǒng)三、實(shí)驗(yàn)學(xué)時(shí):4學(xué)時(shí)四、實(shí)驗(yàn)內(nèi)容:1.組建脈沖波形參數(shù)的自動(dòng)測(cè)試系統(tǒng)2.設(shè)計(jì)脈沖參數(shù)測(cè)量系統(tǒng)界面2.用程控方式完成對(duì)脈沖波形參數(shù)的測(cè)量,顯示脈沖波形及參數(shù)測(cè)量結(jié)果。五、實(shí)驗(yàn)結(jié)果:1、脈沖波形參數(shù)自動(dòng)測(cè)試系統(tǒng)需求分析:答:函數(shù)/任意波形發(fā)生器33220A手動(dòng)調(diào)節(jié)產(chǎn)生脈沖信號(hào),信號(hào)輸出到數(shù)字示波器DSO5012A,在LabWindows/CVI集成環(huán)境下編寫脈沖參數(shù)測(cè)量控制程序,通過(guò)LXI總線控制數(shù)字示波器完成脈沖參數(shù)的測(cè)量,并在用戶界面上顯示脈沖波形及脈沖參數(shù)測(cè)量結(jié)果。2、本次實(shí)驗(yàn)設(shè)計(jì)的脈沖參數(shù)測(cè)量系統(tǒng)應(yīng)用程序界面如下:3、本次實(shí)驗(yàn)內(nèi)容的主體為一個(gè)程序的編制,程序的框架如下:開始開始建立儀器資源會(huì)話示波器初始化自動(dòng)定標(biāo)波形采集脈沖參數(shù)測(cè)量脈沖波形顯示脈沖參數(shù)顯示關(guān)閉儀器資源會(huì)話結(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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 創(chuàng)新教育理念在小學(xué)數(shù)學(xué)課程設(shè)計(jì)中的體現(xiàn)
- 小學(xué)數(shù)學(xué)二年級(jí)第二學(xué)期口算計(jì)算共3031道題
- 小學(xué)數(shù)學(xué)二年級(jí)第二學(xué)期口算計(jì)算共3040道題
- 初中生物七年級(jí)上人教版2.2章末2卷
- 2025年茂名貨運(yùn)從業(yè)資格證繼續(xù)教育考試題
- 2025年陜西貨運(yùn)從業(yè)資格考試題庫(kù)及答案
- 2025年深圳貨運(yùn)b2從業(yè)資格證考試卷
- 個(gè)性化心理健康教育課程的開發(fā)與實(shí)踐研究
- 2025年松原貨運(yùn)上崗證模擬考試
- 關(guān)于如何在家庭教育中運(yùn)用小實(shí)驗(yàn)增強(qiáng)孩子的探究能力的探索
- GB/T 45089-20240~3歲嬰幼兒居家照護(hù)服務(wù)規(guī)范
- 領(lǐng)導(dǎo)干部個(gè)人違紀(jì)檢討書范文
- 2024年秋季新人教版道德與法治七年級(jí)上冊(cè)全冊(cè)教案
- 傳感技術(shù)智慧樹知到期末考試答案章節(jié)答案2024年哈爾濱工業(yè)大學(xué)
- JBT 11699-2013 高處作業(yè)吊籃安裝、拆卸、使用技術(shù)規(guī)程
- 24春國(guó)家開放大學(xué)《離散數(shù)學(xué)》大作業(yè)參考答案
- 國(guó)際發(fā)展援助概論智慧樹知到期末考試答案2024年
- 浙江大學(xué)實(shí)驗(yàn)報(bào)告(流體力學(xué))
- 國(guó)開電大本科《管理英語(yǔ)3》機(jī)考真題(第一套)
- 2023年大學(xué)生《思想道德與法治》考試題庫(kù)附答案(712題)
- 2023年華南理工大學(xué)自然辯證法期末考試真題回憶版帶參考答案
評(píng)論
0/150
提交評(píng)論