LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start/Stop Time Lapse with NI9481

Hello,

 

My project requires that a solenoid valve be opened for 18sec and then automatically closed.  We are using NI 9481 to send the required voltage.  

 

We are using LabVIEW 10.0 and need to be able to operate the solenoid valve multiple times during the activation of the VI.  We have tried using timed loops, the elapsed time express palette, and start button.

 

Basically, we need a way to open the solenoid valve with an impulse pattern, then close the valve after 18 seconds.  Any suggestions are welcome!

0 Kudos
Message 1 of 9
(4,094 Views)

You haven't attached any code so I'm not sure what you want fixed. The simplest method is to simply do a DAQmx Write with a true input, followed by a Delay (hint: setting it for 18 seconds just might be what you need), followed by a DAQmx Write set to false. What is so difficult?

0 Kudos
Message 2 of 9
(4,089 Views)

Dennis Knutson,

 

Sorry, I have now attached the progress I have so far.  I haven't used the DAQmx since I thought using the other function would be simpler, but I may be incorrect.

 

I've never used LabVIEW before this project, so I'm using what little knowledge I have about introductory C++ logic and trying to apply it to LabVIEW.

 

Thanks for the help!

Erin

0 Kudos
Message 3 of 9
(4,065 Views)

Hi Erin,

 

What you want to do is first write some digital line to open your solenoid, wait for 18 seconds, and then write to the same digital line to close the valve. Here is some sample code that should get you started. If you wanted to do this in a loop, you would simply loop around the write and and wait commands (it's not necessary to create and clear the task in a loop).

 

writebool.png

 

Hope this helps!

 

 

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
Message 4 of 9
(4,055 Views)

Thank you so so so much!

 

I just basically added a loop and start/stop button and it was done.

 

-Erin

0 Kudos
Message 5 of 9
(4,042 Views)

Hello again,

 

I had added a loop and button to signal the solenoid valve to open and the only issue that I am having is that the time delay gets applied to the opening the valve AND closing the valve.

 

So the button gets clicked, 18 seconds goes by, the valve opens, 18 seconds goes by again, and then it closes.

 

Can I split up the loops? Sorry for being such a bother, but we're in a bit of a time crunch.

 

Thank you,

Erin

0 Kudos
Message 6 of 9
(4,022 Views)

Hi Erin,

 

A quick comment on the code. You should only have the write and delay statements inside the loop because those are the only functions that need to be executed iteratively. I modified the program to only update the output when you click on the OK Button. You'll see that nothing happens in the timeout case. I set the timeout to be 100 ms (top left of the event structure). Hopefully this sorts things out.

 

WriteBoolwithEvent.png

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
0 Kudos
Message 7 of 9
(4,004 Views)

Works perfectly!

 

Exactly what I needed! You saved the project, thanks a ton!

 

-Erin

0 Kudos
Message 8 of 9
(3,999 Views)

My pleasure. Best of luck!

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
0 Kudos
Message 9 of 9
(3,983 Views)