LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Agilent 33522B Waveform Generator not following Labview input values

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

0 Kudos
Message 1 of 9
(3,423 Views)

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".

controlFG_cds.png

 

 

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...

 

 

0 Kudos
Message 2 of 9
(3,378 Views)

Thankyou for the quick reply.

 

It seemed to be an issue with the driver that was installed. Getting the desired output now!

 

Thanks,

Nita

0 Kudos
Message 3 of 9
(3,362 Views)

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!


GCentral
0 Kudos
Message 4 of 9
(3,359 Views)

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

0 Kudos
Message 5 of 9
(3,012 Views)

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

0 Kudos
Message 6 of 9
(3,001 Views)

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

 

0 Kudos
Message 7 of 9
(2,949 Views)

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

0 Kudos
Message 8 of 9
(2,945 Views)

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.


GCentral
Message 9 of 9
(2,926 Views)