LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to send a pulse to a camera

Hi everyone,

 

I am running a 20 minute test and am trying to record images (by sending the pulse) in 2 different sections dictated by time. First, the VI is supposed to send a pulse every second for the first 60 seconds (60000 ms). Secondly, the VI is supposed to send a pulse every second for the last 30 seconds. I just cant figure out the best way to do this. As shown in the picture, I tried a while loop with 2 case structures inside, but it didnt work. Any recommendations? The outcome of the VI shown below is a signle image at the beginning.

 Apr14VI.JPG

 

Thanks!

0 Kudos
Message 1 of 9
(3,805 Views)
What happens between the end of the first 60 frames and the last 30? I would use a loop, an event structure with two event handlers: timeout and a button to let you abort.

Carry the timeout value so you can change it as needed. 60 one second timeouts, 1 18.5 minute timeout and finally 30 one second timeouts again.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(3,786 Views)

Hi Mike,

 

Thanks for such a quick response! The 20 minute test records force data, but only images from the first and last parts of those 20 mins are needed (and I am not sure if I could even capture that many images without using up the space on my CPU).

 

Im sorry to sound so unintelligent, but are you saying I should have a while loop with an event structure inside that has 3 events: The first event being the initial image caputring, the second being a dead period, and the third being the final image capture?

0 Kudos
Message 3 of 9
(3,778 Views)

Think about the task.  You need to take a picture every time a pulse appears.  This suggests a single loop with a "Timer" and a "Camera".  The Timer could also have a signal that says "All Done", and lets the loop exit.

 

OK, so what does the Timer look like?  You need 60 pulses at 1/second, followed by 30 pulses at 1/sec.  One thing you could do is to realize that this is equivalent to 90 pulses at 1/sec, but we'll stick with two sub-timers.  So how do you create something that happens once per second for 60 seconds?  How about a For loop, count of 60, inside of which is a Wait for Next Multiple, wired with 1000 (1000 msec = 1 sec)?  But you need two loops -- one way to do this is to wrap the Timer loop(s) inside another For loop, this one set to 2, one for each timer.  Put a Case statement inside, wired to the Loop Index (i).  Inside the i=0 case, put the 60-second timer.  Inside the i=1 case, put the 30 second loop,  Inside the Default case (all others), put the logic that says "We're done".  Note that the "two-timer" For loop, inside of which are your two timers, output a single "Take a Pix Now" signal.

 

Try coding some of this up.  Simple For loops, simple Wait until Next Multiple, possibly using a For loop with a Case inside it to count down through numbered states ...

 

This might not be the Most Elegant way to solve your problem, but it is straight-forward, respects the Problem Requirements, and, if you look at the form, it is easy to see that it fulfills the "do this at 1/sec for 60 seconds" requirement.

 

Bob Schor

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

Thank you for the response. I think i forgot to mention that the reason I have broken it into two structures is to control the pulse firing rate. I need the initial 60 seconds to pulse faster than the final 30 seconds. I will give your suggestion a shot!

 

Also, I already have the firing rate and camera part down, im just trying to figure out how to get it to fire continuously for those 2 periods of time at the beginning and end of the run.

0 Kudos
Message 5 of 9
(3,758 Views)

If you have two cases, each case can contain a loop running at any rate you want.  Furthermore, it you need to have, say, 2 minutes of samples at one rate, wait for 5 minutes, then 1 minute at another rate, that's now 3 things to do instead of two, with the middle thing being "Wait 5 minutes".  Same model, just adding another "State".  Hmm, we're building a machine that has multiple States, and goes from one State to another.  What should we call this sort of Machine?

 

Bob Schor

0 Kudos
Message 6 of 9
(3,722 Views)

Bob,

 

I'm sorry, I am new to the Labview game and havent heard of a "State machine", but ill look into it and get back to you.

 

Thanks!

0 Kudos
Message 7 of 9
(3,692 Views)

"State Machine" sounds fancy and sophisticated, but it really is a loop structure with a Case Statement inside it driven from a Shift Register that is initialized with the first "State" and having a mechanism to figure out the next State before finishing the loop.  The For Loop with the Case wired to the Loop Index is a special simple example where the State is merely a count ...

 

Part of the power comes from using Shift Registers to hold variables internally so every State can manipulate them.  Wiring to the Shift Registers from the left edge of the Machine can set Initial values, and wiring to the right edge Shift Registers can get "Results".  Plus you have access to the (evolving) data "inside" the Machine, both inside and outside the Case Statement.

 

BS

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

You mention that through out the test you need to be acquitring force data. How many datapoints and how fast are you measuring it?

 

In terms of the other things, it sounds like you need to spend some time going through the online tutorials for LabVIEW. To do what you need to do you will need to know about event driven priogramming, state machines and probably a bunch of other stuff as well.

 

Exactly how you structure program is going to be dependent upon the other data collection requirements you have. Is there anything other that the Force data that you will need to be acquiring?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 9
(3,665 Views)