01-31-2015 01:27 AM
Hi all,
I'm creating a chirp signal to be displayed in a waveform graph.
The frequency of my signal is from 140-20kHz. I want to stop my while loop when the frequency is already 20 kHz and able to display the plot at that frequency. What should I set in my stop condition in the while loop.
Here is my VI.
01-31-2015 01:29 AM
Here is my VI
01-31-2015 04:15 AM - edited 01-31-2015 04:21 AM
Hi gjjude,
Try this one. Probably the solution.
Regards,
Vijay
01-31-2015 06:09 AM - edited 01-31-2015 06:18 AM
I could be wrong but I'm pretty sure this does exactly the same while cutting down on unnecessary comparisons.
/edit: Okay, I see a difference, the Shift Register would contain a zero if you use the Stop Control to exit the loop. Anyway, the lower equals? comparison can definitely be skipped.
02-01-2015 12:51 AM
Could you explain how this one works?
02-01-2015 02:28 AM - edited 02-01-2015 02:29 AM
@jamison.suade wrote:
Could you explain how this one works?
(Does it? Does not seen to have much to do with the question....)
Sorry, I don't quite understand your problem. Who is modifying the "frequency range" control during the run?
In any case, NEVER do "equal" comparisons on floating point numbers. At least, do a "larger or equal" instead of an "equal".
And why does the loop need to stop to display the result? I also don't have your toolkit, so I cannot test further.
02-01-2015 09:58 PM
@altenbach wrote:
@jamison.suade wrote:
Could you explain how this one works?
(Does it? Does not seen to have much to do with the question....)
Sorry, I don't quite understand your problem. Who is modifying the "frequency range" control during the run?
In any case, NEVER do "equal" comparisons on floating point numbers. At least, do a "larger or equal" instead of an "equal".
And why does the loop need to stop to display the result? I also don't have your toolkit, so I cannot test further.
I strongly belive to altenbach qouted "In any case, NEVER do "equal" comparisons on floating point numbers. At least, do a "larger or equal" instead of an "equal".
and I think you don't need the stop button(what the use?) if you want to stop it automatically when it reach the count 20,
you can do like this
02-02-2015 12:28 AM
Refer this, I hope you will get some idea about floating point comparision.
http://www.ni.com/white-paper/7612/en/
http://digital.ni.com/public.nsf/allkb/B01682241DD825948625665100663F61
02-02-2015 12:18 PM
If you want to stop at a certain count which is known before the loop starts, use a for loop.
Lynn
02-02-2015 01:04 PM
The vi you are using generates a chirp waveform. if you want the loop to stop when the chirp is at 20hz set up the parameters so that the stop frequency is 20 hz an run the loop once in fact- you dont need a loop at all!