LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Galvanometer control and data acquisition with DAQ Card

Hi everyone,

 

I am about to build a 2PE microscope and to do it I'll use two galvanometer from Thorlabs (QS10X-AG and QS10Y-AG) and a Photodetector to acquire the image. I want to create a code in labview to control the galvos and sinchronize them with the photodetector, but I am new at this. 

 

To control it, I am using a the DAQ card from NI USB-6001, where I will attach two outputs( x-galvo and y-galvo) and one input for the photodetector. 

 

As it is my first time using Labview, I have tried to adapt a general code that I found to control galvos, however it is not working and I don't know why. The code adapted is the one published in the article https://www.fresnel.fr/spip/IMG/pdf/Ferrand_CPC_2015.pdf . 

 

The one adapted for me is the one that I attatch below. 

 

As the start trigger I use the /USB-6001/PFI0 from the DAQ. 

 

When I run the code, it stops at the Scan.vi and it appears the next error - Error -200284: Some or all of the samples requested have not yet been acquired.

 

Could someone help me on how to solve the problem or give me any tip to create another labview program to control galvos and sinchronize it with a photodetector with a DAQ Card?

 

Thank you so much

 

Carla

0 Kudos
Message 1 of 25
(751 Views)

Hi CBamera,

 


cbarnera@ub.edu wrote:

As the start trigger I use the /USB-6001/PFI0 from the DAQ. 

 

When I run the code, it stops at the Scan.vi and it appears the next error - Error -200284: Some or all of the samples requested have not yet been acquired.


Your paper has a "Restrictions" paragraph - and your USB6001 does not fulfill the written restrictions…

 

Mind to downconvert your VI to LV2021 or older? (I prefer LV2019.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 25
(737 Views)

Hi GerdW,

 

So, it is too slow for this code? 

 

Do you think that it could be adapted to my DAQ?

 

Of course, go ahead. 

 

Thank you

 

Carla

0 Kudos
Message 3 of 25
(734 Views)

Grew is asking you to save your VI in an earlier version (File >> Save For Previous Version).

 

Anyway, you need to attach your subVI as well.

ZYOng_0-1714050365311.png

 

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 4 of 25
(709 Views)

Hello,

 

Oh, I misunderstood what was he saying. Here I attatch the files in .19 version and also the subVIs.

 

Thank you,

 

Carla

0 Kudos
Message 5 of 25
(703 Views)

In the Init VI, the Start Trigger is set to None. Did you change it to other trigger?

ZYOng_0-1714090947374.png

 

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 6 of 25
(666 Views)

Yes I did, actually when I change it to start digital trigger is when it doesn't work, which was the initial configuration of the code. If I erase the trigger, then the code works, but I am not sure if then is sinchronized.

0 Kudos
Message 7 of 25
(646 Views)

Hi cbarnera,

 


cbarnera@ub.edu wrote:

 If I erase the trigger, then the code works, but I am not sure if then is sinchronized.


The USB600x don't offer all of the triggers like "better" DAQ devices.

AFAIK they only offer a "start trigger"…

 

About sync'ing: the AI is multiplexed so there always is a delay between samples when using multiple AI channels. How good do you need to sync AI and AO channels?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 25
(637 Views)

Ok, maybe this is not the best DAQ that I could use. Anyway, now that I already have it I'll try to find a solution with this DAQ.

 

It is difficult to say how well it has to be the sinc', but what I need is to acquire data from each pixel when the laser is scannig each of it and reconstruc an image with the phtodetector. 

 

Meanwhile we are having this conversation I have tried another way of doing it, but I was using the onboard clock. How well do you think that it is sinchronized? Find the VI attatched with .19 version. 

 

Thank you a lot

 

Carla

0 Kudos
Message 9 of 25
(629 Views)

Hi Carla,

 


cbarnera@ub.edu wrote:

It is difficult to say how well it has to be the sinc', but what I need is to acquire data from each pixel when the laser is scannig each of it and reconstruc an image with the phtodetector. 

 

Meanwhile we are having this conversation I have tried another way of doing it, but I was using the onboard clock. How well do you think that it is sinchronized? Find the VI attatched with .19 version. 


Right now there are some problems in your VI:

  • Please don't create and kill the DAQmx tasks in each iteration of the large loop: init once before the loop and kill the task once after the loop!
  • This large loop should be a FOR loop as you know the number of iteration before you enter the loop. (You can still enable the condition terminal to stop the loop early.)
  • Cleanup the code to make it more readable. Clean code is easier to debug!
  • You don't even need to wire an "Onboard clock" constant as it is the default value…
  • Use a shift register to collect measurement data of several iterations…
  • Never delete the label of FP elements. You may hide them in the frontpanel, but not in the block diagram…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 25
(622 Views)