LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Input of DAQ assistant does not initialize soon enough

Dear all,

 

We are trying to generate an analog voltage output with the NI 9263 and then read that as an analog input with the NI 9215 as part of an academic exercise. Both of these are on board the NI cDAQ-9174 (compact DAQ). An analog waveform is generated within Labview (either a sine, square, or constant), and that signal is fed into the DAQ assistant to make an analog output. 

 
From there, wires connect the 9263 output into the 9215 input. A second DAQ assistant is used to acquire that input voltage from the 9215. 
 
The problem occurs when the waveform generated voltage and voltage input are printed on a waveform graph. The input signal for the sine and square waves occurs before the waveform generation signal (i.e., the input is phase shifted to the left instead of to the right, as we would expect due to latency).
 
We believe the problem occurs because the waveform is being output before the input has had a chance to initialize and start recording measurements. 
 
Is there a way to initialize the DAQ assistant and start taking measurements before the output is generated? Or is there a way to determine the absolute time of each so that we can plot them in absolute time?
 
Thank you for any help you can give.
0 Kudos
Message 1 of 6
(3,731 Views)

Part of your problem at least is your data flow.  One thing you need to undertand about labview is that you have to be careful about the way data progresses through your program.  The easiest way to make things execute in the order that you want them to is to make sure you wire the error signal sequentaly through the ins and outs of each sequential daq icon instead of having the error out of each merged together.

Message 2 of 6
(3,715 Views)

If you run the input and output processes in parallel, you have a much better chance of capturing the response. Triggering can also be your friend if your hardware supports it.  Running a continuous input acquisition which is started before the output starts will assure that you capture the response although it does not tell you anything about when the output started.

 

General comments: You have a huge amount of duplicated code.  Except for the signal source generation the code in each of the three cases seems to be very similar.  Move the case structure inside the while loop and only put the parts which differ inside the case strucrture.  Things like the file pathname generation and the 10/(A/D Span) calculation which do not change while the program is running belong outside the loop. Why  recalculate the same thing repeatedly? You also seem to have an aversion to straight wires! Try Diagram Cleanup. At the very least do not run wires under or behind other structures where it cannot be seen how they connect.

 

Lynn

Message 3 of 6
(3,703 Views)

Thanks! Putting the input DAQ assistant first in the flow allows us to capture the behavior.

0 Kudos
Message 4 of 6
(3,654 Views)

I tried cleaning up the program as best I could. I'm sure you can tell I am new with LabView. Thanks for taking a look even though it was so messy.

 

The problem we are having now is that the input data lags the output data by anywhere from 30-50 ms, which seems like far too large a delay. This is when I turn the Waveform Graph to "Ignore Time Stamp". Because the generated output voltage is graphed from the waveform generator, it seems to take a while for it to progress through the program and through the hardware, thus the input voltage graph lags.

 

When I turn the Waveform Graph to not "Ignore Time Stamp," the signal from the waveform generator occurs in the year 1903. I've tried searching on how to change this to the current time, but I can't seem to find a way to do that, despite plenty of other people wondering about this. Is there a way to do this so we can know the time at which the generated waveform signal is actually sent to the output DAQ assistant?

Download All
0 Kudos
Message 5 of 6
(3,649 Views)

If the timestamp is showing up 1903, you're getting the all 0's point.  It works by counting seconds since that point.  You'll want to take a look at how you're setting your timestamp.

0 Kudos
Message 6 of 6
(3,628 Views)