04-16-2013 04:08 PM
I just had a specific labview question.... So for our relay VI (which works fine), we now want it to continuously start/stop about every 1 second, instead of having to click the button a hundred times. This seems like it would be an easy fix, I'm just having trouble figuring it out. I've played around with "for loops" and "waveform" VIs, but haven't had much luck. I've attached the VI for the relay. Thanks.
Solved! Go to Solution.
04-17-2013 03:02 PM - edited 04-17-2013 03:03 PM
Do you want the relay to turn on and off at 1second intervals?
If so, first make another ULx Write VI inside the loop and wire a true constant to one and a false to the second Write VI. This should make the relay turn on an off as fast as possible.
Now you can add timing. To do that, you could place a Wait (ms) VI in 2 sequence structures which would be placed just before and just after one of the write VI's. Wire the reference and error wires into these sequence structures which contain the Wait VI's.
So all together we would have a while (or for loop).
The reference and error wires would come in the left of the loop.
Next they would then go in a sequence structure of one frame. The frame would have a wait vi inside.
Next the wires would pass into a write vi with a true constants.
next they would then go in a sequence structure of one frame. The frame would have a wait vi inside.
Next the wires would pass into a write vi with a false constants.
You should close your virtual channel outside the loop on the right.
Did I explain this correctly and does this help?
Thanks,
Eric
04-18-2013 09:23 AM
Wow... I'm going to be honest, I am very new to LabVIEW. The project am I working on is my first experience using LabVIEW. I've watched all of the tutorials, but the program still isn't something I'd say I feel confident about. I am sure everything you just told me is correct, but there are parts of your explanation where you kind of lost me. Particularly this part:
Next they would then go in a sequence structure of one frame. The frame would have a wait vi inside.
Next the wires would pass into a write vi with a true constants.
next they would then go in a sequence structure of one frame. The frame would have a wait vi inside.
Next the wires would pass into a write vi with a false constants.
Would I be out of line in asking you to send me the VI? So I don't spend hours beating myself up trying to figure this out. I understand if you don't want to do it for me, but if you could, I would REALLY appreciate it!
04-19-2013 09:42 AM
I cannot write the VI for you because I don't have the particular VI's that you're using. Here is a screenshot of what the code should look like with DAQmx VI's used instead. This should help you understand my text a bit better.
04-20-2013 09:18 AM
The picture helped a lot! Thanks! Just one more question and I'm done. What exactly is the green icon labeled status? And is that a "or" or a "Not or" icon connected to the stop button?
04-20-2013 09:31 AM
Here is a screen shot of what I have, but as you can see, something isn't connected correctly
04-20-2013 01:13 PM
No need to respond to that last question. I just scrapped that part of the VI because I really didn't need it, and the relay works exactly how I want it to now!
Thanks so much for all of your help Eric! I really appreciate it!
04-20-2013 10:28 PM - edited 04-20-2013 10:46 PM
in the cld....
7. Timing
b. Timing functions:
3. Avoid using any of the Wait functions to time a software operation
so try this instead of using the Wait ms function and using the Daq write twice....
04-22-2013 12:16 PM
That's a much cleaner method. Thanks for posting.