06-27-2018 02:57 AM
Hello,
I am trying to set input parameters to Agilent 33522B function generator from LabVIEW 2017 front panel via USB interface.
When I'm switching on the FG, and starting a fresh run (with inputs set on the front panel just before clicking the single run button), the values are reflected on the FG correctly and the program stops.
But when I'm running the program again after changing the input values, the changes are not seen on the FG. I have to switch it OFF and then switch ON, then only it is taking the new values.
1. How can I keep giving the inputs and see them on the FG, without switching it ON every time?
2. I'd like to do it in continuous run also.
Attaching images of Block diagram and front panel.
I am relatively new to LabVIEW. Any help would be appreciated. Thanks in advance.
Thanks,
Nita
06-27-2018
10:13 AM
- last edited on
01-05-2025
03:50 PM
by
Content Cleaner
Well, that Event Structure in your code is a bit suspect. You should review how Event structures work. You don't need one here, so replace the Event structure with a case structure. Wire the "Configure" button to the case structure. Change the action of the "Configure" button to "Switch when pressed".
You should probably disable the output in code after the measurement is complete. The AWG may not allow you to change the setup parameters you want with the output enabled. (It might be disabled by the INIT the next time you run it, but it might not.)
Long term if you are going to be controlling the AWG trough software look at a State Machine design pattern; one state initializes communications, one state enables/disables output, one state changes parameters of the waveform, one state closed communications, etc.. See - https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentat...
06-28-2018 02:07 AM
Thankyou for the quick reply.
It seemed to be an issue with the driver that was installed. Getting the desired output now!
Thanks,
Nita
06-28-2018 03:58 AM
Although I'm glad you've gotten it 'working', I'm also suspicious of what might be going on.
The Event Structure is a good choice for changing settings on changed user settings, but the typical usage involves an Event Structure in a While loop, with one of the "Value Change" events being for a Stop button, with the output (or a True constant) wired to the While loop's Stop terminal in that case, and a false in every other case (typically through the Use Default if Unwired setting).
You might consider something with multiple Events on the same case for the Configure you have set up, and then a Measure boolean control (e.g. push button, OK button with changed text, etc) for the "Enable Channel" assuming that is used to make a measurement.
If the channel needs to be disabled to change the settings, make sure to do that too!
01-14-2020 04:03 AM
Hi cstorey and all other people,
I've read this post and have almost the same task but with a litle extra functions and would like to have any advice from you.
I want to create four configurations at frontpanel like Save configuration, Get configuration, Set configuration and Reset configuration.
At Save configuration I want to be able to save to a file with own file name,
at Get configuration I could fetch the above saved file,
at Set configuration the aplication is the start mode
and at Rest configuration I could reset all the values of the channel.
Thank in advanced for your advices.
/mctnnn
01-14-2020 09:14 AM
Sounds like you need a state machine design with an event structure to handle the buttons. Look into state machines with event structures here:
- https://www.youtube.com/watch?v=RuIN31rSO2k
- https://www.youtube.com/watch?v=aT0obtY3PRk + https://www.youtube.com/watch?v=ZR3qSX4e94c
If you get stuck with implementation post your code here for help.
Craig
02-03-2020 02:30 AM
Hi Craig,
thank you very much for the links you've attacked and they are very useful.
During the work with implemantation of those configurations,
I discovered that the two square signals are not syncronized when I've checked in the oscilloscope.
The signals do not stay still, and I could see on the screen of the oscilloscope,
the square signal 2 scrolls from left to right.
The content of two .vi, 33522BChannel1 and 33522BChannel2 is the same, the only different between
these two .vi, is the frequency of channel 2 is depending on the frequency of channel 1 and Divider
(divider is any constant >=1).
My question is why the signal in channel 2 is not stable, it scrolls from the left side to righ side,
Any sugguestion to tackle it, thanks.
/mctnnn
02-03-2020 02:39 AM
I've attached the .vi for my last quesion,
but for some reason, it was denied,
so I attached the picture of the .vi as .png instead.
/mctnnn
02-03-2020
06:34 AM
- last edited on
01-05-2025
03:51 PM
by
Content Cleaner
Hi mctnn,
The subVIs weren't attached to your post, but based on what I can see in the image, and given the VI that I downloaded (sometimes the VI initially doesn't appear, but then later does - it's a weird forum quirk) I'd guess that they are not triggered together to synchronised in any way, and so the delay between the two is variable, which leads to variable delay on a triggered oscilloscope.
Probably the driver includes some method to start all channels at a specific time (together), rather than as soon as you set them.
You're also setting them in a loop, which might not be what you want/need.
Perhaps you can implement the suggested State Machine to change the output types, and have some idle or timeout state when you don't change any of the inputs.