Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

who can I syncronize the output semnal and the input semnal and plot them on a graph

Hello,

I use MeasurementStudio 8 with VS2003 C#

In my program I use 2 tasks , each with a single analog  channel each , one task is for writing the output signal , and the other is for reading the  input signal.
The output signal is passed through a external device , then it is read with the input task.

My current approach is this :
I create the 2 tasks
I attach to each task an analogsinglechannelreader and a analogsinglechannelwriter
I generate the desire waveform and save it into an array
I plot the signal onto the graph
I write the signal with writemultisample method
I read the input signal with readmultisample method
I plot the input signal onto the graph
I analize the input signal in correlation with the output signal

here is the code I use:

graph.outputsignal.PlotY(amplitudiniOutput);
writes.WriteMultiSample(true,amplitudiniOutput);
amplitudiniInput=reads.ReadMultiSample(amplitudiniOutput.Length);
graph.inputsignal.PlotY(amplitudiniInput);

Now the BIG problem 😞 , in the graph the inputsignal is shown before the outputsignal with an offset of about 15ms (which is impossible) , that would not be a problem if the offset would be always the same ....I could translate the array)
I'm don't have now access to the computer with the daq card so I can not add a printscreen of the graph
If I use the simulated card the problem with the offset does not appear.

So I ask .. what am I doing wrong ?

Thank You in advanced

Message Edited by amutianu on 05-17-2007 02:51 PM

0 Kudos
Message 1 of 2
(3,238 Views)
Hi,
 
Thankyou for posting to the National Instruments Discussion Forums. You will need to use a start trigger to synchronize your input with output.
 
Essentially you will designate one task as a master, say for example the analog input is the master, and one task as the slave, say analog output is the slave.
 
Now your analog output has to wait on a trigger from analog input. You can setup a trigger using the DAQmxCfgDigEdgeStartTrig function and use the ai/StartTrigger line as the source for the trigger. If you start you analog output first, it will wait on a trigger and wont start until the analog input has started.
 
Hope this helps!
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 2
(3,221 Views)