05-13-2013 12:53 AM
Hello all,
Please take a look at the following VI and please make your suggestions:
I am using it to turn a particular signal ON/OFF when required without tuning the VI off, and thought about employing an Event Structure and learn about it more at the same time.
Only when the " Enqueue Element" button is clicked, the signal from the Generator Starts. Consequently, when the "Turn O/P OFF" button is clicked the Signal Generator stops, but the VI still runs, I don't want it to stop.....(in this case it does nothing). However, this sequence works only once. If you click on Enqueue Element button again - nothing happens.
I would like to turn it on and off again and again.....(or at least repeat above-mentioned sequence twice) at any time whithout terminating the VI. Is it possible? What would be the best way to implement such function?
Thanking everyone who spared their time reading and helping in advance......
05-13-2013 01:28 AM
Hi!
If you press "Turn OP Off" the consumer loop goes to "Wait for event" case.
As a result of the True constant the consumer loop will exit (that is: no more commands will be consumed)
On the contrary the produced loop will keep running....
With a consumer dead and a producer still running it's not a surprise this vi works only once.
Regards,
Marco
05-13-2013 01:57 AM
Hey Marko,
Thanks for your reply. If making it to work as simple as changing the True constant, I've tried both and both times unsuccessful. Please elaborate more on your comments.
05-13-2013 05:16 AM
I think you should revise your consumer loop adding a case to stop the generation of the signal.
Then you shold add a case to restart the generation.
Upgrade the user interface and the producer loop consequently.
Example: create a "Signal Off" button, add an event case queuing a "Stop task" command, add a case in consumer loop in which you execute the "Stop task "DAQmx vi.
Regards,
Marco
05-13-2013 07:03 AM
Hello,
I hope attached VI should be fine.
LV 2011
Regards,
Bijay
05-13-2013 05:55 PM
Hi there,
Marco, thank you for your suggestions, I'll try to add a new cases and see if that works......
Bijay, thanks for the modification to my VI. However, it does not work properly..... After hitting the Stop O/P button, the generation stops, but never re-starts when clicking on Enqueue Element button. So, it's kind of back at the same problem as before....
Thanks for the try.
05-13-2013 06:10 PM
LabView 2012 (64 bit), Windows 7, DAQ USB 6212......I should have mentioned that before, but don't think it makes any difference.
05-13-2013 07:56 PM
Have a look at the attached.
When dealing with QSM's, be extra carefull of the way you handle messages. Have a look at the thread below about QSM's. Should be plenty more reading material and examples that you can find around.
http://lavag.org/topic/16154-qsm-producerconsumer-template/#entry98307
Kas
05-13-2013 08:13 PM
Hey Kas,
Thanking you for the link provided...... it's right on the subject.....
Appreciate your time and effort on making mods on the VI.
Best Regards,
eleorka
05-13-2013 09:55 PM
Hi Kas,
I regret to say that I am still experiencing some problems here. Your design VI works fine by itself.
I think the problem is in the way how the Waveform Generator is coded. After including it in your design the stop button doesn't stop the signal generation.
You have to hit it twice for it to react. After that the re-generation doesn't work as before. What is the problem here?
I left the incrementing part of your design just to use the difference in loop speed variation.