版權(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 房屋買賣合同誠(chéng)信承諾書3篇
- 政府采購(gòu)辦公設(shè)備合同3篇
- 工業(yè)煤氣供應(yīng)與安全合同3篇
- 斷橋鋁門窗安裝合同3篇
- 教育機(jī)構(gòu)店長(zhǎng)任職合同3篇
- 常用塔吊用工勞務(wù)合同3篇
- 摩托車買賣合同電子版3篇
- 攝像服務(wù)合同3篇
- 控?zé)煆奈易銎?篇
- 按月租房合同范本簡(jiǎn)單版3篇
- 《行動(dòng)研究法》課件
- 云南省昆明市西山區(qū)2023-2024學(xué)年三年級(jí)上學(xué)期期末語(yǔ)文試卷
- 腸梗阻病人護(hù)理查房課件中醫(yī)
- 試生產(chǎn)檢查準(zhǔn)備表
- 月下獨(dú)酌(其一)李白
- 《大學(xué)物理學(xué)》精美課件(全)
- 七年級(jí)上冊(cè)數(shù)學(xué)壓軸題幾何試卷(帶答案)
- 網(wǎng)絡(luò)安全保密教育知識(shí)普及培訓(xùn)課件
- 家長(zhǎng)會(huì)課件:初二上期家長(zhǎng)會(huì)課件
- 接待上級(jí)領(lǐng)導(dǎo)工作總結(jié)
- 著色滲透探傷檢測(cè)報(bào)告
評(píng)論
0/150
提交評(píng)論