11-11-2021 02:36 PM
Hello, I wrote an laser scanning imaging code which includes the mirror scan settings and data sampling settings. When I click white arrow to start the program, the scan settings always 2~3 seconds delayed than the data sampling part.
I don't know how to add a delay to data sampling at the start. I tried to add delay in for loop or while loop. They did not work or delay at each loop.
I only need one 2~3 second delay for the data sampling to make sure it is synchronized with the mirror scan part. (VI attached)
Thank you
Solved! Go to Solution.
11-11-2021 03:08 PM
Hi Rhapsody,
at first you should clean up the block diagram to make the VI readable…
How good do you need to sync both DAQ loops?
11-11-2021 03:16 PM
Hi, GerdW,
The VI I attached is mainly consisted of the scanning part and the AI part(AI part is directly from AI example in Labview). I used to tried not to use the DAQ assistant for scanning control, but I cannot complete the synchronization between AI and two channels AO (one channel for one mirror).
Can you please send me a template of synchronization between AI and two AOs if you have one in hand.
Thank you very much.
11-11-2021 07:49 PM - edited 11-11-2021 07:51 PM
If you want to just pause between two subVIs that are wired together just insert a "stall data flow,vim" into that wire and wire the number of ms to wait into the stall.
Programming -> Timing -> Stall Data Flow.vim
If the two subVIs do not have any dependencies put the second one in a single frame flat sequence and wire some output of the first to the frame with a stall data flow between the first subVI and the frame. The variable does not have yo be used in the frame, just be wired to it in order to manage the data flow.
PS next time save your program to V2012 so that everyone can open it,
11-12-2021 08:51 AM
Hi, GerdW,
Please have a look at the previous version of VIs I attached. One is the 2 channel output only and the other is 2 output channel and 1 input AI channel which need to be synchronized.
In the output only vi, I add a channel in the code but it shows error of channel not matching.
In the 2AO1AI vi, it says the error of specified resource is reserved.
Can you please help me to modify them?
Thank you very much
11-12-2021 08:58 AM
Hi, Tom,
Thank you for your suggestions. I have add the time delay in the code and it seems more synchronized than before and I think it is better to do it through DAQmx.
I have tried to write some synchronized code for 2AO channel and 1 AI channel. but it shows error as attached.
In the purpose of finding the problem, I wrote another 2 AO only code and still error. I need to set different AO frequencies and amplitudes separately but I found some errors happen.
Could you please help me to modify these codes?
Thank you very much
11-12-2021 03:17 PM
I only have time to drop some hints.
1. You should not branch the AO task wire and try to start it twice. Both channels of data should be written to the one and only AO task before starting it. Be sure you've defined the same # samples for both channels.
2. I've been in a lot of discussions about DAQmx hardware sync. Couldn't find many examples quickly, but here's one that can act as a starting point. You'd just substitute your AI task in place of the CTR edge-counting task in the example. And of course you'd handle your AI data differently than the way the example handles the CTR data. But the key concepts are described and illustrated nicely -- share a sample clock signal and start the master task last.
-Kevin P