01-09-2013 09:06 AM
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.
01-09-2013 10:31 AM
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.
01-09-2013 10:34 AM
@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. 😉
01-09-2013 10:44 AM
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.)
01-09-2013 10:47 AM - edited 01-09-2013 10:48 AM
@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.
01-09-2013 11:16 AM
@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.
01-09-2013 12:53 PM - edited 01-09-2013 12:54 PM
@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?
01-09-2013 01:15 PM
@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.
01-09-2013 01:21 PM
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.
01-09-2013 01:37 PM
@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.