LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse Timing

Hi, I'm just getting back into LabView and haven't used it in a while.

 

I need to activate a digital output on my DAQ for a certain duration (~4ms) and am not sure on the best way to accomplish this.  I am using a lot of the outputs, except I only need 1 output to be active for that duration once the user presses a "go" or "ok" button on the front panel.

 

I was thinking of using a while loop, but I'm not sure on the syntax and whether this is the appropriate method to use.

 

Any help will be appreciated!

 

Thanks,
Colin

0 Kudos
Message 1 of 10
(3,970 Views)
I figured I should attach a copy of my VI.  The one I need to activate is RLIGBT1 for a certain duration.
0 Kudos
Message 2 of 10
(3,969 Views)

Hey,

Use two daq assistant for DIO one where you can set the ms time and other you just output.

Cheers

 

-Lab

0 Kudos
Message 3 of 10
(3,935 Views)

I'm confused by what you mean.  Here's where I've gotten so far on my own.  I'm not sure what you mean though.  Will the one just outputting stop?  Should the DAQ assistants be in the while loop?  You lost me.

 

I'm usting LabView 8.2.1 and I'm attaching a screenshot of my current progress (who knows if it's anywhere near the right direction).

0 Kudos
Message 4 of 10
(3,926 Views)
Sorry, I had a mispelling and forgot to attach the image.
0 Kudos
Message 5 of 10
(3,918 Views)

Well I'm trying something new and am unsure on how it will work.

 

Can I do something like the attachment I posted?  I'm trying to add the numeric control to the tick count when the while loop is called and compare it to the current tick count, stopping the while loop when the current surpasses the original + duration.

 

Secondly, with this current configuration will the while loop only be activated when the Run button is called?  That's what I'm trying to go for.

 

One more thing, what can I input to the DAQ that will allow for it to be turned off when the while loop ends?  I figured I could use a boolean, but there's only an output so I can't see how to switch to false when the timer reaches it's threshold.

 

Thanks in advance,

Colin

0 Kudos
Message 6 of 10
(3,896 Views)

Hey,

I see you want to run your DAQ when you press OK button, the best practice will be to use events or the simpler way is to sequence structure with blank while loop running and the OK button connected to Stop terminal of that while loop and in the second sequence structure you will have your regular DAQ code.

 

Keep us poted on it goes.

 

Cheers

Lab

Message 7 of 10
(3,867 Views)

Thanks for the reply.  I think I get what you're saying but don't know how to implement it.  What port in the event structure would I attach the OK button to? 

 

And how would I turn the DAQ off after the say 4msec period I want it to be active for?

 

Thanks again,

boz

0 Kudos
Message 8 of 10
(3,816 Views)

Hi Colin,

 

If going with the event structure, you don't actually connect the OK button directly, rather it is configured as a part of the event case.  Check out the following description of event structures for a little bit more information:

Event-Driven Programming in LabVIEW

 

If you want to turn off the digital lines of your DAQ device, you could explicitly write the lines to go low after breaking out of the loop.  You could also call DAQmx Reset Device.vi outside the loop.

 

 

Which DAQ device are you using by the way, and how much jitter is acceptable when generating the 4 msec pulse?  Currently you are using the Windows clock to time the pulse, so there would be non-trivial amount of variance in the pulse width.  Depending on the hardware you are using there may be other options.

 

 

-John

John Passiak
Message 9 of 10
(3,793 Views)
I GOT IT.  I've got it doing everything that I need it to do.  Thanks to everyone who helped.
0 Kudos
Message 10 of 10
(3,731 Views)