LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows环境下调用Agilent33120A的程序

Agilent33120A的程序如下: #include #include #include "hp33120a.h" main () { ViReal64 value; int i; ViSession hp33120a; ViStatus error = VI_SUCCESS; ViString popUpMsg = "The function generator is outputting the waveform " "that you configured.\n\nPress to continue"; /* If you want to run this sample program and the instrument is not present, set the Simulate flag to 1. (Example: "Simulate = 1") */ checkErr( hp33120a_InitWithOptions ("usb0::2391::1031::MY44027032::INSTR", VI_TRUE, VI_TRUE, "Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1", &hp33120a)); checkErr( hp33120a_ConfigureOutputMode (hp33120a, HP33120A_VAL_OUTPUT_FUNC)); checkErr( hp33120a_ConfigureOutputImpedance (hp33120a, "1", 50.0)); for (i=1; ;i++) { checkErr( hp33120a_ConfigureStandardWaveform (hp33120a, "1", HP33120A_VAL_WFM_PULSE, 5.0, 2.5, 1000.0, 0.0)); checkErr( hp33120a_ConfigurePulseDutyCycle (hp33120a, i)); checkErr( Ivi_GetAttributeViReal64 (hp33120a, "", HP33120A_ATTR_PULSE_DUTY_CYCLE, 0, &value)); if (value>=90) break; } checkErr( hp33120a_ConfigureOutputEnabled (hp33120a, "1", VI_TRUE)); MessagePopup ("Message", popUpMsg); Error: if (error != VI_SUCCESS) { ViChar errStr[2048]; ViStatus tmpError; hp33120a_GetError(hp33120a, &tmpError, 2048, errStr); MessagePopup ("Error!", errStr); } if (hp33120a) hp33120a_close (hp33120a); } 我想编写另外一个函数(此函数的代码为上面main函数里的代码),然后用main函数调用它,实现此功能。请问应该怎么做?谢谢
0 Kudos
Message 1 of 1
(3,406 Views)