LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to be sure that an event start before an other ?

Hi !

 

I am a newbie.

As you can see in the image attached, I want to light a diode (with an USB-6009), then take a picture (with a wireframe camera) and turn of the diode, all this in the shortest possible time.

But I have to wait some time (here 50ms) to be sure that the diode is on .

Is there a way to do this more rigorously?

 

Thanks in advance,

Y.

 

 

0 Kudos
Message 1 of 21
(2,579 Views)

You don't want your code to run in parallel.  Write to your LED, wait the 50ms, capture the picture, then turn off your LED.  You will need a sequence structure for the wait, but you can just use the error cluster to use data flow to sequence your code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 21
(2,555 Views)

@crossrulz wrote:

You don't want your code to run in parallel.  Write to your LED, wait the 50ms, capture the picture, then turn off your LED.  You will need a sequence structure for the wait, but you can just use the error cluster to use data flow to sequence your code.


That always annoyed me.  Why isn't there a primitive to take care of the "wait-in-a-sequence-structure" thing?  One of the first things I do on a new project is import a sub-vi made for just that purpose.  Or maybe I just answered my own question - everyone already HAS a sub-vi to take care of it.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 21
(2,545 Views)

In the correct world, your capture program has error input/ouput terminals (does it?) that could just be strung on the error wire after the analog write operaton.

 

Why are you hammering the analog output in a tight loop like crazy? Once you write the new value, ist stays there until you write something else.

 

(There is no need to wait or anything. If you want a small delay due to some external hardware delay, add an "express wait", it also has error IO. No sequence needed.)

0 Kudos
Message 4 of 21
(2,533 Views)

@billko wrote:
Why isn't there a primitive to take care of the "wait-in-a-sequence-structure" thing?  One of the first things I do on a new project is import a sub-vi made for just that purpose.  Or maybe I just answered my own question - everyone already HAS a sub-vi to take care of it.  😉

Well, the idea has 653 Kudos as of writing this post.  Maybe one of these days...

 

But yeah, that was the first VI I put into my library.  Made the icon small too.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 21
(2,526 Views)

@crossrulz wrote:

@billko wrote:
Why isn't there a primitive to take care of the "wait-in-a-sequence-structure" thing?  One of the first things I do on a new project is import a sub-vi made for just that purpose.  Or maybe I just answered my own question - everyone already HAS a sub-vi to take care of it.  😉

Well, the idea has 653 Kudos as of writing this post.  Maybe one of these days...

 

But yeah, that was the first VI I put into my library.  Made the icon small too.


Yeah, made mine one connector high, also.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 21
(2,506 Views)

@billko wrote:

Yeah, made mine one connector high, also.


Are you doing this purely for space considerations or is there anything in your subvi other than the 'wait(ms)' function?
0 Kudos
Message 7 of 21
(2,497 Views)

@Flohpange wrote:

@billko wrote:

Yeah, made mine one connector high, also.


Are you doing this purely for space considerations or is there anything in your subvi other than the 'wait(ms)' function?

Not so much "space" considerations, as "time."  Saves you from having to drag the wait(ms) onto the screen, enclose it with a one-frame sequence and then run your error cluster wire (usually) through it.  It gets tedious when you have to string together a whole bunch of waits.  (Programming a certain ultra-dumb power supply comes to mind.)

 

Since there is only an error in, an error out and a numeric control for ms, I made the icon only one connector in height.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 21
(2,489 Views)

But why would anyone use the wait(ms) function inside a sequence structure? If you need the error in/error out, the Time Delay function can be used. I'm sure the existance of this is why we will never see the wait(ms) modified.

0 Kudos
Message 9 of 21
(2,485 Views)

@Dennis_Knutson wrote:

But why would anyone use the wait(ms) function inside a sequence structure? If you need the error in/error out, the Time Delay function can be used. I'm sure the existance of this is why we will never see the wait(ms) modified.


Because... maybe it is riding in my blind spot?  I was curious and opened it up and there's one more layer to it, but it ends up using the wait(ms) anyway.  It's funny, and I'm sure it's some kind of local abberation (read: company-specific), but no one I know of uses that express vi, either.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 21
(2,472 Views)