08-25-2009 10:35 PM
Hi All,
I am controlling an Agilent 33210A function generator over USB with the IVI drivers installed on the host PC. I am trying to write a utility that compiles to an executable which will configure the generator and enable/disable output. I want to allow for a scenario where the user configures the function generator once, and then enables/disables its output repeatedly over time. I initialize the instrument with the hp33210a_init call, configure it, turn on output, and then use the hp33210a_close function to let go of the handle and end things. This works.
My problem is that the only way I can configure the instrument is by overwriting the settings on it. Once it's set up, I want to be able to enable/disable output using the settings that are currently on the instrument. I have tried to use the hp33210a_init to NOT reset the instrument when all I want is to enable/disable output, but the same thing happens- the instrument goes back to its factory defaults from the settings I put on it before - settings that worked. How can I enable/disable output by using my executable utility without enetering new settings, which exits once the user issued a command on the prompt (my utility works over the command line)?
Thanks for everyone's help!
Solved! Go to Solution.
08-25-2009 11:44 PM
08-26-2009 02:32 PM
Hello Dima2882,
The following function is part of the drivers that I downloaded from here. It looks like it just enables/disables the device.
ViStatus hp33120a_ConfigureOutputEnabled (ViSession instrumentHandle, ViChar _VI_FAR channelName[], ViBoolean outputEnabled); Purpose This function configures whether the signal the function generator produces appears at the output channel you specify. The driver sets the HP33120A_ATTR_OUTPUT_ENABLED attribute to the value you pass in the Output Enabled parameter.
If this is not what you were looking for, post a couple lines of code, so I can see what you are currently doing, and describe why it doesn't work.
Regards,
08-26-2009 02:55 PM
Hi Peter, thanks for your reply.
Here's what I've got that works and sets up the function generator properly (it's a snippet obviously):
cmdStatus = hp33120a_init ("33210A_Func_Gen", VI_TRUE, VI_FALSE, &PPS_funcGen); cmdStatus = hp33120a_ConfigureStandardWaveform (PPS_funcGen, "1", HP33120A_VAL_WFM_PULSE, ppVoltageLevel, (ppVoltageLevel/2), pulseFreq, 0.00); cmdStatus = hp33120a_ConfigurePulse (PPS_funcGen, "1", pulsePeriod, highPulseTime, 20.0e-9); cmdStatus = hp33120a_ConfigureOutputEnabled (PPS_funcGen, "1", VI_TRUE); cmdStatus = hp33120a_close (PPS_funcGen);
At this point my utility goes quits... However, let's say I did this and later want to disable output without removing any of the pulse settings... I'll do this:
cmdStatus = hp33120a_init ("33210A_Func_Gen", VI_TRUE, VI_FALSE, &PPS_funcGen); cmdStatus = hp33120a_ConfigureOutputEnabled (PPS_funcGen, "1", VI_FALSE); cmdStatus = hp33120a_close (PPS_funcGen);
When I do this , the output does indeed get disabled and my utility exists... However the settings go back to the factory defaults. I do not want this...What could I do?
08-27-2009 12:13 PM
Dima2882,
The IVI drivers are programmed to load the default settings during the init call. Here are a couple of suggestions, in order of highest recommendation:
The first 2 are preferred as you will not have to alter the drivers, and reduce the risk on introducing more complication. If they will not be suitable for your application, you should use CVI to open the driver source, make the changes, then rebuild the drivers.
Let me know your thoughts.
Regards,
08-27-2009 12:43 PM
Great! Basically, you confirm my current observation.
My requirements force me to close the session once the instrument is configured. So, the "painless" option is out. For now I will follow your option #2, but in the near future I will be changing the driver and living with the consequences.
Thank you for taking the time to answer my question. Yay for the forum 🙂