LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing of Piezo and Camera

Solved!
Go to solution

Hi,

I'm trying to control the movement of a piezo transducer and the acquisition of images from a camera with exact timing. Firstly, I'm trying to drive the piezo in a sinusoidal manner at a frequency, f. Secondly, I want to acquire images with my camera at a frequency of 2*f. i.e. I want to acquire when my piezo voltage is at the maximum and minimum values.

 

I'm relatively new to LabVIEW but I have figured out how to control my piezo and acquire images independently. However, I'm running into problems with timing when I try to do the two things in unison.

 

At the moment, I'm using a loop and the 'Simulate Signal' function to generate my voltage output to my piezo. I then have a second loop in parallel to drive my camera acquisition. I've gone to a bit of effort to make sure that the two loops start executing at the same time using 'Rendezvous'. I have my current VI attached. It kind-of works but I'm sure there's a better and simpler way of doing it. If one of the loops runs slightly off-time for some reason, the loops will fall out of sync after many iterations. Would I be right in saying that I'm going about the process the wrong way in not using just one loop? I've thought about this but I don't know how to implement it? If I put the image acqusition loop into the piezo loop, won't the process of acquiring an image knock out the timing of my piezo?

 

If anyone could offer any advice it would be great!

Thanks in advance,

Paul

0 Kudos
Message 1 of 6
(2,799 Views)

Hi PaulNap,

 

Thanks for attaching your code along with your query!

 

Looking at what you want to achieve I think using two parallel loops is a good call. It means you can seperate the execution of the signal generation and the timing of the camera.

 

Of course, what you really want is to achieve some kind of co-ordination between the loops, such that the camera acquisition loop only runs when the signal generation loop generates a peak value.

 

I've written and attached a simple bit of code that illustrates this idea. I am using notifiers to co-ordinate the loops. The top loop only writes a value into the notifier when it generates a peak value. Since the bottom loop is waiting on the notifier, it will only ever run once the top loop has written a value into the notifier. In this way, the bottom loop will only ever run when the top loop generates a peak value.

 

Please let me know if you have any questions about this.

 

Kind regards,

Josh E
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 6
(2,773 Views)

Hi Josh,

 

Thanks a million for the reply. Unfortunately, I have an old version (2010) and cannon open your vi. Could you post a screen shot maybe?

 

Thanks,

Paul

0 Kudos
Message 3 of 6
(2,771 Views)
Solution
Accepted by topic author PaulNaP

Hi Paul,

 

Here's my attachment in LabVIEW 2010.

 

Kind regards,

Josh E
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 6
(2,768 Views)

I'm glad I was able to help!

 

Good luck with your application.

Josh E
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 5 of 6
(2,759 Views)

Josh,

 

That's exactly what I was looking for. I'm implementing it right now.I don't see any reason why it shouldn't work.

 

Thanks again,

Paul

0 Kudos
Message 6 of 6
(2,757 Views)