From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

33210A function Generator

Solved!
Go to solution

I downloaded the plug and play drivers for the function generator 33210A from the ni website: http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=103

 

vi1.JPG

 

This code works fine. The only issue is that i want it to work continuously. I want to be able to change the amplitude, frequency and Waveform without stopping the program. So I assumed putting it on a while loop should do it. Unfortunately when i run the program on a while loop the outputs go all wrong. I can see the meter display changing the values when i change them from the program but the values been output are completely wrong. Any one experiencing the same issue??

 

vi2.JPG

 

0 Kudos
Message 1 of 4
(1,210 Views)
Generally you only want to update settings when needed. One way to do this would be to put an event structure inside the while loop, and configure it so that changing the value of any of those settings controls will trigger the event.

As you have it now, you are sending commands to the function generator as fast as possible, which it probably doesn't like. If you just a put a Wait function inside your loop with something like 1000ms input, it should behave much more reasonably. (But the event structure is the way to go).
0 Kudos
Message 2 of 4
(1,171 Views)

I believe the problem is that the main setup VI you're running there has many different setup options and sends them all each time it runs.  I have used a 33120A before but not recently, and I seem to remember that some things can change "live" with no problems, like voltage, and others cause the output to completely reset.  And you're doing this as fast as your communications bus allows, which is another way to mess it up.

 

I recommend the following:

  • Take the two VIs out of the While loop and put them in front of it.  This will just be your initial setup.
  • Replace the contents of the While loop with an event structure.
    • Change the VISA terminals to be shift registers
    • Pass the VISA wire through the event structure, turning off the "Default if not wired" option on it so that the reference always stays good
  • Create a Value Change event for your Stop button as well as all of the controls that you made that set up each of the waveform options.
  • Have the Stop button trigger the stop terminal as before.
  • For each of the other value change controls, open the setting VI, find just the small piece of the setting that sets just that one portion of the waveform setup.  Send only that command when one setting changes, not all 4 or 5 settings as one giant chunk.

 

You'll probably find that one or more of the settings will still cause a twitch (I'm guessing the "waveform type", since switching from Sine to Triangle or whatever will be a big change) but since you are only changing one setting at a time, and not trying to change them 1000 times a second, it'll behave better.

Message 3 of 4
(1,169 Views)
Solution
Accepted by topic author josear04

Guys,

 

Thanks a lot for you help. Actually i was able to do what i wanted. Apparently there was one thing making crazy the meter. so i just needed to take that out to the loop.

testtt.png

 

the waveform function and the units have to be out of the loop. the rest of it can stay inside. So basically I rewrite the whole program without all the sub vi and make it one single program.Thanks again.

0 Kudos
Message 4 of 4
(1,117 Views)