01-12-2010 03:57 PM
Good day: I am using AO Waveform gen.vi to produce a 40Hz wave, and the vi successfully produces the wave during the highlight execution mode. When not in the highlight execution mode, however, the output signal is not the desired sine wave, but rather sporadicly decaying traces with variable amplitudes.
Any help is greatly appreciated, Thanks!
01-12-2010 04:16 PM
Post a VI. Perhaps some screenshots of what the traces look like that are good and bad.
Kind of hard to help without seeing some code and examples.
01-13-2010 03:26 PM
ok, we've come to the idea that the problem involves the ao wait.vi. we used the ao config, write, start, wait, and clear in place of the ao waveform gen and find that when ao wait is inside of the while loop that ao config, write,and start are in there is an infinite loop which prevents the rest of the program from running while the buffered waveform runs to completion. when we move the ao wait to outside of the while loop, the waveform isn't seen at all, but the rest of the functions on the front panel not included within the while loop do run. additionally, changing the buffer size does impact the length of time that the program is stuck within the infinite loop.
if this is a problem with the ao wait i'm not sure how to arrange the vi's to acheive a constantly running waveform without causing an infinite loop.
thanks for any help you may lend
01-13-2010 03:50 PM
First, I'll give a couple of general recommendations.
1. It would be better if you converted the VI to use DAQmx functions instead of the traditional DAQ functions. Those are becoming obsolete.
2. You have some places where you use local variables when you should be using wires to connect with the terminals of the controls.
3. You have used some extended datatypes on some of your controls (like for slope.) You should be using a double representation floating point unless you have a good reason why you need the extended precision numbers.
I asked for a copy of the VI, but you posted a screenshot that shows only a portion of the VI. So it is difficult to be certain if this advice is appropriate. I don't see where the infinite loop is in your screenshot that you are referring to. But in general, if you have a situation where you want to have code run in parallel and not have a section of code be held up waiting for something else, you should use a producer/consumer architecture and pass the data from one loop to the other by way of queues.
01-13-2010 04:50 PM
sorry for the pics, i had to split them up, but here is the whole thing
this, again, doesn't contain the infinite loop's location, which occurs in the second image in the top middle while loop at the ao wait.vi location. i think the infinite loop may occur because the while loop doesn't interate until everything in it is completed,and everything in the loop isn't completed until the ao wait undergoes 5 iterations, preventing everything else in the function (data writing and front panel graphical displays) from working. this, at least, is how i interpetted the way in which ao wait works. we are looking at the output of the function on an oscilloscope so we can tell when the function is in an infinite loop (when used in highlight errors mode) because we get the correct 40Hz output, but the front panel is frozen; and when there is no infinite loop we see that there is an incorrect display on the oscilloscope, but the front panel is always updating and changing its displays (this occurs when we don't do the highlight error mode)
the problem is quite confusing to us and i can only imagine how it may appear to you, we greatly appreciate your help or any input you can give
01-13-2010 06:45 PM
I said post the VI. The actual file. Not a larger, bigger image of the block diagram.
Are you saying the "infinite while loop" is inside the AO wait VI? Otherwise I don't know where it is.
All of my tips in the previous message still apply, particularly getting rid of these DAQ functions and replacing them with DAQmx (unless your DAQ card is so old that it isn't supported by DAQmx) and reworking the architecture so that the part that is taking a long time is in its own loop.
01-13-2010 07:25 PM - edited 01-13-2010 07:27 PM
Never mind. Took me so long to scroll down to the image, I didn't even see Raven's reply.
Why oh why do people think it's better to post an image and not the actual code?
01-14-2010 10:06 AM
sorry for my mistake. I am a novice labview user so it will take me some time to update the daq to daqmx, but thanks for the suggestion it seems like they will make the vi more intuitive.
The 'infinite loop' arrow, which appears when the program is run in the highlight errors mode, appears within the ao wait vi when the program reaches the vi and prevents the rest of the vi from progressing