LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to synchronize XY stage movement and oscilloscope data saving in one LabVIEW program (Thorlabs NRT100/M)

This is still very broken. It seems you miswired and LabVIEW automatically inserted feedback nodes (to fix broken wires, but make things much worse!, see here and links). Steps Y should be a control, not an indicator and cannot get values from inside the loop because that makes no sense at all! An indicator cannot be a data source!

 

The value wired to N of a FOR loop cannot be obtained from inside the FOR loop! Right? RIGHT???

 

Go back to the basic tutorials first.

 

You should use a simple state machine, Not a pyramid of stacked loops! Make sure all controls have reasonable default values. start-step=0 is NOT reasonable!)

0 Kudos
Message 11 of 15
(125 Views)

See if this draft can simply some of your scan logic.

 

altenbach_0-1761772601055.png

 

 

Of course if all your positions are integer micrometers, there should be very little orange.

0 Kudos
Message 12 of 15
(115 Views)

Hi altenbach,

Thank you so much for your previous explanation and for sharing the simplified scan logic example — it really helped me understand how to structure the scanning process more clearly.

I’m now trying to combine everything into one working setup, and I’d really appreciate your advice on whether my current approach makes sense.

  1. Kinesis stage control:
    I have another part of my code that initializes the Thorlabs Kinesis controllers (CreateDevice, EnableDevice, Home, etc.).
    I’m planning to run this initialization only once before the main scan loop starts, and then pass the motor references into the loop for movement control.
    Is that the correct approach, or should the initialization be directly connected to the loop?

  2. Oscilloscope integration:
    For oscilloscope data acquisition, I’m thinking of replacing the XY Graph section in your example with VISA-based oscilloscope read and save commands,
    so that each step of the stage movement corresponds to one waveform being captured and stored.
    Would this be a reasonable way to integrate it?

  3. Trigger synchronization:
    I plan to use a function generator as the master trigger source, sending a TTL pulse simultaneously to both the oscilloscope (as External Trigger In) and to the PC (via a DAQ Digital Input line).
    The idea is that each trigger pulse will make the oscilloscope capture a waveform,
    and LabVIEW (through the DAQ input) will detect the same pulse and then move the stage to the next position.
    Does this sound like a proper synchronization method?

If you could confirm whether this setup makes sense or suggest a more reliable structure, I’d really appreciate it.
Thank you again for your patience and helpful guidance — it’s been a huge help for me to understand how to tie everything together.

Best regards,
Yujn

0 Kudos
Message 13 of 15
(88 Views)

Hi everyone 👋

I’m currently working on synchronizing a Thorlabs XY stage (NRT100/M via Kinesis ActiveX), a Tektronix oscilloscope, and a function generator within one LabVIEW program. The goal is to build a fully automated measurement setup where all three devices operate in sync.

In my LabVIEW setup, the XY stage is controlled using Kinesis commands (CreateDevice, EnableDevice, Home, etc.). The stage initialization is executed once before the main scanning loop starts. After that, the program moves the stage along the X-axis in 100 µm steps, pauses, triggers the oscilloscope to capture a waveform, and saves the data. Once one line (about 1 cm) is completed, the Y-axis moves down by 100 µm, and scanning continues in the opposite direction.

In my current draft, the scan logic was visualized using an XY Graph. I’m now trying to replace that section with VISA-based Tektronix oscilloscope read and save commands, so that each stage movement step corresponds to one waveform being captured and stored. Would this direct substitution be an appropriate approach? Or would it be better to keep the oscilloscope acquisition block outside the scan loop and handle synchronization separately?

For synchronization, I’m considering using a function generator as the master trigger source. The function generator will send a TTL pulse simultaneously to the oscilloscope (as External Trigger In) and to the PC/DAQ digital input. The oscilloscope will capture a waveform based on the trigger, while LabVIEW detects the same signal and moves the stage to the next position. Would this be a reliable way to synchronize all devices? Or should LabVIEW move the stage first and then wait for the next trigger pulse instead?

Lastly, regarding stage initialization: is it okay to execute all Kinesis initialization commands (CreateDevice, EnableDevice, Home, StartPolling) once before the loop, and then pass the motor references into the loop for motion control? Or would it be safer to include the initialization process inside the loop for synchronization stability?

I’ve attached my current VI (Main_1101.vi), which combines the XY scanning loop with partial oscilloscope control logic. Any advice, example block diagrams, or structural suggestions on how to properly synchronize the stage, oscilloscope, and function generator would be greatly appreciated 🙏

Thank you so much for your time and support!
Best regards

0 Kudos
Message 14 of 15
(86 Views)

@yujiiin wrote:

I’ve attached my current VI (Main_1101.vi), which combines the XY scanning loop with partial oscilloscope control logic.


You did not attach a VI with that name! (No VI without tolevel loop should contain "main" in the file name!)

 

If all your devices should perform their operation foe each xy position, their code simply belongs into the innermost loop. If they need to execute in a specific order, you can enforce dataflow, e.g. with the error wire.

 

You also need to ensure that the loop stack waits until all instruments are ready. Currently, you don't even have a toplevel loop and both code islands execute in parallel. I recommend to implement a simple state machine.

 

(Please don't continually start new threads about the same discussion. I have merged your threads)

0 Kudos
Message 15 of 15
(44 Views)