09-03-2014 03:01 PM
@belopsky wrote:
Im not sure what you mean by, why am i closing the queue reference? i am not? i did not think I was..
I'm not asking why you are closing the queue, but rather why NOT?
When you open a queue reference you need to close that reference again, else you will get into problems later.
@belopsky wrote:
...
The queu is being used for acquisition and logging. Somewhat a producer/consumer.
...
No, you do not have anything remotely close to Producer/Consumer pattern, sorry.
One reason for that is, you create, write and read in the same case in the same while loop.
There is no need for that queue, it has no function that a direct waveform wire from DAQmx read can't do.
09-03-2014 03:07 PM
guess thats me being a noob.
i will make the changes you suggested
09-03-2014 03:12 PM - edited 09-03-2014 03:13 PM
And then to the = question:
Try to answer the two questions.
09-03-2014 03:24 PM
And don't take my comments the wrong way, I'm just trying to help you a little more on the way to better programming.
09-04-2014 06:42 AM
The loop will never stop since there is nothing wired to the end loop terminal Couldn't resist.
09-04-2014 12:15 PM
Thank you Doug, great help.
09-04-2014 12:48 PM
This is my Pulse Train vi:
That is the subVI I use to control the continuous pulse-train with my main code. The issue I have is that once this starts, my UI 'freezes' and I cannot press anything. as this is continuous, it never stops. I must click the red STOP in LabView to quit the program.
I understand that currently, the way the while loop is, it will run until an error or the stop button is pressed.
What is the best way for me to implement this to stop when the user presses a stop button on the main front panel (the code posted in my first post).
Is there a better way for me to run this subVI?
Thanks!
09-04-2014 03:06 PM
09-04-2014 03:32 PM
It's still not clear to me if you are adjusting an analog voltage or controlling a digital PWM signal. The code looks like a PWM signal so I will show what I have done for this.
I created a functional global variable with an init/start case, a modify case, and a stop/close case as shown below. That way I can start supplying the signal, go off and do lots of other stuff, change the d/c and frequency as needed along the way and then close it when I am done for the day.
I feed the d/c out for other purposes and is not required just create the signal. The 6221 daq I use has two timer/counters so I can select either one as needed.
I also limit the range for the d/c and frequency. Get much below 20kHz on the frequency and you can start hearing it depending on what you are sending it to. Brushless motors in my case.
09-05-2014 07:22 AM
Dennis, the while loop is there just as in the 'Counter - Continuous Output.vi'