I need help synchronizing my DAQ IO signals properly. What I am trying to do is move two galvo motor with mirrors attached incrementally (4-100 points) in sync with a laser diode signal. Picture pointing a laser pointer at a mirror and moving the mirror around while holding the laser pointer stationary; that is the broad view of my setup.
I want to send a laser pulse signal once for each incremental movement of the galvo mirror, no more no less. I have breadboarded a PWM trigger signal that I am using to both turn on and off the laser AND move the galvo. The signal is 200-300 Hz, where the HIGH time is always 350us. Only the low time changes when switching frequencies.
My DAQ IOs are:
I am able to successfully get everything working in sync, but am always getting one extra pulse due to a timing delay on the trigger on/off signal. The DO I am sending to turn the trigger off takes anywhere from 3-7ms extra, causing for extra unwanted pulses coming from the laser after the mirror has stopped moving.
Here is a picture of the main loop of my code as well as a scope photo of my signals.
Signals above are:
yellow = trigger signal (PFI0)
blue = trigger on/off signal (p0.0)
green/purple = two galvo mirror signals (ao0 and ao1)
In the scope photo I am trying to run a total of 4 pulses, but the trigger does not stop until 5.44ms after the fourth trigger pulse, and I end up getting an unwanted pulse from the diode. This 5.44ms varies +/- 2ms each operation.
If anyone has any suggestions as to how I can turn the trigger signal off more quickly I would be so grateful!
已解决! 转到解答。
Well, you could just generate that "PWM trigger" signal with one of your 6341's onboard counters. Then you can set it up with the high/low time combo you want, and configure it for Finite Sampling and exactly 4 pulses. And you'd no longer need that software-timed DO task that can't perfectly sync with the hardware-timed AO task anyway.
-Kevin P
Thanks, this worked. To anyone interested, here is what I ended up with: