Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pulse ON/OFF a digital signal

Hello,

 

To control a chamber valve, I need to turn ON a digital output for 60ms and turn it OFF.  Here is an attachment jpg that shows how I am achieving it. My valve currently stays open for some seconds before closing again. I don't know how to achieve 60ms. Furthermore, I am using the Labview version 2018. I used the timer functions where I have no idea for how long time my while loop is iterating. can you suggest some suggestions regarding my VI.

Thanks.

program.PNG

 

 

0 Kudos
Message 1 of 9
(1,994 Views)

To get precise timing control you would need to implement the timing on a hardware level and not on software (note, there is always software overhead when communicating with hardware). To achieve the exact 60ms, you need Hardware timed Digital Output on the instrument and you must load the waveform to generate to the instrument and start.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 9
(1,968 Views)

Let's evaluate what your VI currently does.

 

1.  It sets up the DAQ task.

2.  It gets an initial time.

3.  It starts a loop.

4.  It get the time again and compares it to the time from #2.

5.  If the time difference is less than Y, the result is False.

6.  The result goes through NOT turning it to True.  The True value gets written out and your digital output turns on.

7.  Because the boolean from 5 is false, the loop does not stop and begins again starting at #3

8.  If the time difference is greater than Y, the result is True.

9.  The result goes through NOT turning it to False.  The false value gets written out and your digital output turns off.

10.  Because the boolean from 8 is now True, the While Loop will stop and it will exit.

11. Outside the loop, the task is stopped, cleared, and any error messages are displayed.

12.  The VI ends.

 

So you got a pulse on for Y milliseconds, then turns off.  VI is done.

 

What value is in your Y control?  How is your VI behaving differently than what I described above?

 

If you want to know how long your VI has been operating, but an indicator on the output of the subtraction and it will tell you how many milliseconds.

 

0 Kudos
Message 3 of 9
(1,962 Views)

As you said I have kept an indicator in order to know how many milliseconds. The problem is let us say the x value is 3525 which is less than the  y value which is 3600 number then it is true. But when is it true the pump turns on few seconds and turns off. Now I want to control this few seconds and make it to 60 milliseconds when the y value is true which means greater than x. I named the  y value as pulse width. 

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

Can you guide me to achieve I am very new to LabVIEW?  

0 Kudos
Message 5 of 9
(1,941 Views)

There is only one way I know that this entire loop iteration would take several seconds to run.

 

Are you running this VI with Highlight Execution turned on?

0 Kudos
Message 6 of 9
(1,922 Views)

yes I have highlighted and after checking it only i told you the value of x .

0 Kudos
Message 7 of 9
(1,908 Views)

Do you know what highlight execution does?

 

It shows you the data flowing down the wires, and so that you can actually see that, it intentionally slows down the execution of the code.  There is now way you could see the values if the code was executed at full speed where loop iterations are in the millisecond level.

 

Turn off highlight execution and you'll be fine!

0 Kudos
Message 8 of 9
(1,864 Views)

Thank you for your help. Here I am attaching a png file in this I want to turn off the second digital output in 30 milliseconds before my VI stops can you guide me on how I can achieve it. For now, the second digital output is turned on even the VI stops. 

0 Kudos
Message 9 of 9
(1,856 Views)