LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to switch analog output between two waveform frequencies

Hello,
 
I'm using a fairly simple VI to generate a square wave at our analog output board.  I have the square wave controls in one panel of a sequence structure, and a "release" function in the other panel of the sequence. Currently the VI is programmed to switch from the original square wave to -10V when the Boolean control is switched.
 
What I'd like to do now is to modify the VI so that I can swtich between a square wave of a given frequency, say 100 kHz, to a square wave of a different frequency, say 10 kHz, or to DC -10V. But I'd like to be able to vary each frequency and amplitude independently.
 
Could anyone give me some programming pointers?

Thanks,
Michelle
0 Kudos
Message 1 of 5
(3,292 Views)

Michelle,

I'm assuming you are using DAQmx (?). 

If you are not changing the waveform shape, just the speed, there is a DAQmx Timing property node.  One of the properties is SampClk.Rate.  I have limited experience with it, but you might be able to use it to change the time between samples so that the waveform appears faster/slower.  Let me know if this doesn't work.

 

Message 2 of 5
(3,278 Views)

Michelle,

Since you want to be able to vary the amplitude and frequency independently, I assume you have two sets of controls or inputs?

Why not just use the boolean to control a case structure, the true case routes one pair of Freq. and Amp. to the square wave generator, and the false case routes the other pair to the generator? In the simplest case, you would have a constant of 100kHz in one case, and a constant of 10kHz in the other, easily selectable.


Data Science Automation

CTA, CLA, CLED
SHAZAM!
0 Kudos
Message 3 of 5
(3,261 Views)
Hello Michelle,

I would recommend that you examine the example called "Gen Mult Volt Updates-Data Types Example.vi". You can find this example by opening the NI Example Finder. You can find this utility by going to the Help menu in LabVIEW and selecting Find Examples... Once the NI Example Finder is open you can find this example by selecting Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage from the Browse tab. I hope this information is helpful.


Matt Anderson

Hardware Services Marketing Manager
National Instruments
Message 4 of 5
(3,251 Views)

Thanks to the three of you for the suggestions. I started trying a few of them, and then realized that what I had already built will work pretty well to update the frequency. I didn't realize that it would update the waveform in "run" mode -- I thought it would only do that in "run continuously" -- so I've found that I can change the frequency of the waveform by doing that. This doesn't allow me to change the frequency and the amplitude simultaneously, but I'm not sure yet whether or not I will need to do that -- I so will probably go ahead with the experiments I need to do with this set-up, then modify it if I find that I need to control both frequency and amplitude simultaneously.

Thanks for your help!

M.

0 Kudos
Message 5 of 5
(3,240 Views)