sorry I have a very simple problem.But it seems I am too new to LabVIEW... and / or have no idea. Tried a few things but nothing worked out propperly.
I need to generate a sinewave with the following flexible parameters.
f = 0.02 Hz ... 10Hz
Amplitude = 0 ... 500
I would like to see a slider moving up and down following the sinewave. The parameters should be changeable at any time therefore the sinewave generation sits in a While Loop. If that would works I plan to integrate that into some code that I wrote for an Arduino, Makerhub, servocontrol.... The values hinting already...
I tried allmost all singnal generation VIs that I could find but nothing worked. Timing totally dependet on a wait insid the while loop...
Frequencies below 1Hz made the slider fast again ... WTF ... 🙂
A sine wave of 1Hz should make the slider go up and down 1 time in a second... or am I totally wrong here.
Ah... Maybe some other question. If possible I would like to count the period. For example after 4 periods of the sinewave the programs stops.
Any help apprechiated... I am working with LabVIEW 2012SP1
Solved! Go to Solution.
It would be easier if you attach your code to this post.
You can develop the code which stops your program after a certain number of cycles.
OK... here we go.
f = 1Hz does not work.
Then the frequency of the slider depends on delay. Funny for me, as a sinwave with 1Hz which I specify should have a frequency of 1 Hz...
Yeah, you have a fundamental problem with your expectations. You are generating a waveform which has specific timing information embedded into it and then throwing it all away by displaying its output in a totally unrelated timebase. This is like filming a car going 60 miles an hour and then wondering why it appears to go slower when you slow down the playback of the film. I suggest you forget about watching a slider go up and down. Even with a real-time OS that could actually display the signal properly there's little to be gained by that info. Use a Waveform graph and read the timing info from the X-axis and the amplitude info from the Y-axis. It's like an oscilloscope display.
The real question here is what are you doing with your signal? Do you have a DAQ card that can actually generate a voltage? What Kind? What are you connecting it to?
Go take a look at some of the DAQmx examples to better understand how to use it. Start with: Help > Find Examples... Hardware IO > DAQmx > Analog Output > Voltage - Continuous Output.vi
Here is a good webpage on the 10 basic DAQmx functions: http://www.ni.com/product-documentation/2835/en/
First you have to understand how this waveform generating function works. You specify a waveform (amplitude, frequency, etc.) and every time you call the function, it returns all of the points of the specified waveform.
You can set the number of points with the #s control of the sampling info cluster. Since you have placed the function in a loop, every itaration gives you #s number of points (1000 in your case). Still you get a sine wave on your slider because every iteration returns a different set of 1000 points (This is due to the method, the function calculates the waveform).
The simplest way of creating a sine wave is using the Sine function (Mathematics/Elementary/Tigonometric/Sine). You should use the i iteration counter of the loop as the input of the Sine function. Note that the input is in radians.
With a little calculation you can easily produce and display a 1Hz sine wave.
sorry for my late reply. First quiet weekend since some bigger renovation.
Thanks for the help. I think I got it now. Thanks again for all the suggested hints and solution.
The simplest solution for me is really the simple sine function and using the iteration counter of the loop . Easy... Thanks again.