LabWindows/CVI(435003):LabWindows/CVI,,,,:;LabWindows/CVI;;;:TP216+11:B:1004373X(2007)0802703DesignofVirtualFunctionSignalGeneratorBasedonLabWindows/CVIKEYanming(HuangshiInstituteofTechnology,Huangshi,435003,China)Abstract:ThispaperprovidesadesignprocedureofvirtualfunctionsignalgeneratorbasedonLabWindows/CVI,inclu2dingsystemhardwareconfigurationandsoftwaredesign.Virtualinstrumenttcchnologyusesthenewestcomputertechnologytorealizeandexpandthefunctionoftraditionalinstrumentandhastremendousapplicationpotentialityinexperimentalteach2ingandengineeringfieldbecauseofitsmuchmoreadvantagesthantraditionalinstrument.Theexperimenthasproventhatthesignalperformancegeneratedbyvirtualfunctionsignalgeneratorsurpassesordinarytraditionalinstrument.Keywords:virtualinstrument;LabWindows/CVI;functionsignalgenerator;hardwareconfiguration;softwaredesign:200609211LabWindows/CVI[1,2]1986(NI),,,,,,,,,,,:TurboC,MicrosoftVisualBasicVisualC++,BorlandDelphi,SybasePowerBuilder,,;HPVEE,NILab2VIEWLabWindows/CVINILabVIEW,,,,NI,Lab2Windows/CVIANSIC,,C,,,C,C,,,2LabWindows/CVI2.1,1NI1200Lab2PC27220078247þü1200[2]PC,(A/D),(D/A)/8,2,24I/O316/Lab2PC21200,12.222(1)8:1Panel,1Graph,1Ring,1Button4Numeric:CVI,FileNewUserlnterFace(3.uir),,(2),(CONSTANTNAME)(CallbackFunction)2.3,CV1,:CodeGenerateAllCode,OK,#includeuserint.h#includeanalysis.h#includeansic.hintshape=0;doubleamp=10,phase=0,numpcyc=100,cycnum=1;voidDisplayChart(void);intmain(intargc,char3argv[]){if(InitCVIRTE(0,argv,0)==0)return(-1);if((panelHandle=LoadPanel(0,xhy.uir,PANEL))0)return-1;DisplayPanel(panelHandle);SetCtrlVal(panelHandle,PANELWFM,shape);/33/SetCtrlVal(panelHandle,PANELAMP,amp);/33/SetCtrlVal(panelHandle,PANELPHASE,phase);/33/SetCtrlVal(panelHandle,PANELNUMPCYC,numpcyc);/3/3/SetCtrlVal(panelHandle,PANELCYCNUM,cycnum);/33/RunUserInterface();return0;}intCVICALLBACKGetWFM(intpanel,intcontrol,intevent,void3callbackData,inteventData1,inteventData2){switch(event){caseEVENTCOMMIT:GetCtrlVal(panelHandle,PANELWFM,&shape);/33/DisplayChart();break;}return0;}intCVICALLBACKGetAMP(intpanel,intcontrol,intevent,void3callbackData,inteventData1,inteventData2){switch(event){caseEVENTCOMMIT:GetCtrlVal(panelHandle,PANELAMP,&);/33/DisplayChart();break;}return0;}intCVICALLBACKGetPHASE(intpanel,intcontrol,inte2vent,void3callbackData,inteventData1,inteventData2){switch(event){caseEVENTCOMMIT:GetCtrlVal(panelHandle,PANELPHASE,&phase);/33/DisplayChart();break;}return0;}intCVICALLBACKGetNUMPCYC(intpanel,intcontrol,inte2vent,void3callbackData,inteventData1,inteventData2){switch(event){caseEVENTCOMMIT:GetCtrlVal(panelPanelHandle,PANELNUMPCYC,&numpcyc);/3/3/DisplayChart();break;}return0;}intCVICALLBACKGetCYCNUM(intpanel,intcontrol,inte282:LabWindows/CVIvent,void3callbackData,inteventData1,inteventData2){switch(event){caseEVENTCOMMIT:GetCtrlVal(panelPanelHandle,PANELCYCNUM,&cycnum);/33/DisplayChart();break;}return0;}voidDisplayChart(){doublef,3wave;intsamples;f=1.0/numpcyc;/33/samples=cycnum3numpcyc;/33/wave=malloc(samples3sizeof(double));/33/DeleteGraphPlot(panelPanelHandle,PANELGRAPH,-1,1);/33/switch(shape){case0:SineWave(samples,amp,f,phase,wave);/33/break;case1:Squrewave(samples,amp,f,phase,cycnum,wave);/33/break;case2:TriangleWave(samples,amp,f,phase,wave);/33/break;}PlotY(panelPanelHandle,PANELGRAPH,datapoints,100,VALDOUBLE,VALTHINLINE,VALEMPTYSQUARE,VALSOLID,1,VALRED);/33/}},:Ed2itaddFileToProjecta11Files(.3),RundunProject,LabWindow/CVI,LabWindow/CVI,,3,,,,,,[1].[M].:,2002.[2].LabWindows/CVI[M].:,2003.,1968,,,,(DTV),,,,,?,,:FM!AMFM,FM(DAB),-2(HD),,,,:SiriusXM(FCC),,SiriusMelKarmazin,SiriusXM,iPodsHD,()9220078247þü