Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize the start of analog and digital tasks in C#

Solved!
Go to solution

Hello all,

 

I am having trouble synchronizing the start of an analog and ditigal output task in C#. Specitifically, I have created a master analog output task and a slave digital output task that uses the AO Task's sample clock. Everything works fine except there is always a random delay between the signals because they are triggered to start separately in software. I would like to start both tasks with the same trigger signal.

 

I think that I need to do something like:

 

digitalTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("Dev2/ao/StartTrigger",DigitalEdgeStartTriggerEdge.Rising); 

analogTask.Start();

 

but DAQmx is throwing an error saying that my tigger source is not valid. Is this the correct idea? What is the exact syntax for inputing the trigger source. Thanks much for any help!!!

 

-Jon 

0 Kudos
Message 1 of 3
(3,731 Views)
Solution
Accepted by topic author neuronerd

Hi Jon-

 

     If you have the sample clock shared across both tasks, you should be able to just start the slave task first, that way when the master task starts, the slave task will start taking samples on the same clock edge.  You shouldn't have to use a start trigger.

 

     However, if you are trying to import an external trigger, you would hook it up to a PFI line and specify "Dev2/PFI0" as the trigger source for both tasks (or whichever PFI line you have hooked the trigger up to).

 

     I hope this helps.  Best of luck with your application!

Gary P.
Applications Engineer
National Instruments
Message 2 of 3
(3,708 Views)

Yup that did it. 

 

Thank you Gary!

 

-Jon 

0 Kudos
Message 3 of 3
(3,696 Views)