LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

DAQmx Triggering Synchronization

Highlighted

Hi Everyone,

I'm using Labview 16.0f2 and DAQmx (6341) to do triggering in/out and I'm having issues with getting things to occur in the order that I want them to.  I'm trying to synchronize a camera and stepper motor.  What I want to do is take a digital trigger in (indicating that the camera is ready), step an analog voltage (to the next motor position), then output a trigger (telling the camera to fire).  Each of these things should happen in sequence.  The issue that I'm having is that I'm only taking a step in analog voltage once for roughly ever 15-20 digital triggers in/out.  This is illustrated in the attached oscilloscope image -- the yellow trace is the digital trigger in, the blue trace is the digital trigger out, and the purple trace is an example voltage step.  What am I doing wrong--how do I synchronize both of my triggered events?

Thank you!

0 Kudos
Message 1 of 3
(467 Views)

Is this really one of the Examples that ship with LabVIEW?  Which one?

 

Some general comments:

  • Good LabVIEW code has essentially no Local Variables.  Learn how to use Controls and Indicators with Loops and Shift Registers.
  • If you are outputting 1 channel, 1 point, why is your AO Write N channels, 1 point?
  • What are the timing parameters of your AO channel?
  • Do you understand the Principle of Data Flow (the First Principle of LabVIEW)?  You do know that the loop cannot "loop" until all of the code inside it has run, in particular, it will be "clocked" by the slowest element in the loop.  I'm guessing it's the AO Write (hence the previous question).
  • The reason that the digital triggers go 15 times faster is that they are running "on their own clock" since you set them up that way.
  • Do you know enough LabVIEW to get the CLAD certification?  If not, spend a lot more time with the tutorials, or work with a colleague/mentor.

Bob Schor

0 Kudos
Message 2 of 3
(421 Views)

The main issue you have is that your AO task is software-timed, only updating as fast as your loop can iterate.  Your retriggerable pulse is hardware-timed, and can react at hardware speeds much faster than your AO task.

 

Call DAQmx Timing.vi in your AO task config and specify the external trigger signal "/Dev1/PFI1" as the 'source' input wire.    You'll then also need to pre-compute a buffer of AO values and write them to the AO task *before* you start the task (and before you enter the main loop).

 

But the essential thing is to make sure the timing of both your output pulse and your AO are being timed by the same external hardware signal.

 

 

-Kevin P

0 Kudos
Message 3 of 3
(411 Views)