LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple waveform charts not displaying data simultaneously

Solved!
Go to solution

Hi,

 

I am using a USB-6009 to acquire three analog input voltage signals simultaneously. I want to plot two of the voltage signals wrt time, while for the third signal, I want to extract the frequency and then plot the frequency wrt time. I want all three waveform charts to have an x-axis in units of seconds starting at zero seconds. My VI block diagram is below:

 

Frequency and Voltage Plots Block Diagram.png

 

When I run the VI, I'm getting some issues. Firstly, the Frequency chart isn't plotting any data and although I'm happy the time starts and remains at zero, it's counting up by tenths of a second instead of by just seconds.

With the Voltage 1 and 2 charts, the voltage is being read correctly, but the x-axis is in terms of time and date instead of seconds. The VI front panel is below:

 

Frequency and Voltage Plots Front Panel.png

 

I have tried running the VI with only the third voltage signal being read and the waveform chart plots the frequency perfectly. The front panel and block diagram is below:

 

Frequency Plot.png

 

Could someone point out what I am doing wrong in the first VI?

Download All
0 Kudos
Message 1 of 6
(4,911 Views)

What do you want to do in the first VI?  You appear to be taking in 3 channels of 1000 points, sampled at 10KHz, so your Chart should "jump" 10 times a second as 1000 new points are added.  You define t0 for each waveform as the current time, and plot your data using Absolute Time (which means the Time Axis has date and clock time, rather than "seconds since start of experiment" or something I would consider more useful).

 

But what do you want to plot on the Frequency graph?  Do you notice that while the other plots are Waveform plots and include a 1D Y array of 1000 points, you have a single thin orange wire (meaning a single float) going into the Frequency Chart.  You should expect the points will accumulate there 1000 times slower than the other two plots.

 

Somehow, I think that is not what you want, but it seems to be what you programmed.

 

Bob Schor

0 Kudos
Message 2 of 6
(4,892 Views)
Solution
Accepted by topic author ahsan2

1. You should use the Mutiple Channels Multiple Points Waveform Array version of the DAQmx Read.  Then you don't have to build up the waveforms yourself.

2. Arrays indecies are 0 based.  So the filrst element of the array is actually 0, not 1.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 6
(4,878 Views)

Thanks for the help crossrulz. I followed your steps and got the VI to work exacttly how I wanted it to. I also managed to get all the charts to start at zero seconds using the VI found here: Start at Zero with Relative Time using Waveform Data in Charts

 

My updated VI is below:

 

Frequency and Voltage Plots Block Diagram v2.png

0 Kudos
Message 4 of 6
(4,868 Views)

i am currently working on a very similar project and im using NI USB-6009 to acquire two different waveforms from analog input, I tried the updated code that you have done but I am only getting reading from voltage 1 and the the other two graphs are not being plotted, urgent help is required. Thank you 

0 Kudos
Message 5 of 6
(3,725 Views)

Well, I don't have LabVIEW 2017 installed on this laptop, but I do have a 6009.  I first configured a Task in MAX (because I'm lazy and don't like to mess with all those DAQmx functions one at a time) to do the following:

  • Take Analog Input from AI0, AI1, and AI2.
  • Set Range:  0 to 5 v, Differential.
  • Set Acquisition for Continuous Mode, 10 samples at 100 Hz.
  • Save Task as Test-6009.
  • Open Block Diagram, create Error In (constant). 
  • On Error Line, drop Start Task, DAQmx Timing Node, DAQmx Read, DAQmx Stop Task, and Simple Error Handler.
  • Set DAQmx Read to Multi-Channel, Multi-Sample, 1D Waveform.
  • Drop While Loop around DAQmx Read (keep other functions outside loop), wire Stop Control to Stop Indicator.
  • Wire Constant to input of Start Task.  Click down-triangle, choose created Task, Test-6009.
  • Wire Task wire from Start Task through Property Node through DAQmx Read to DAQmx Stop Task.
  • Set Property Node to Read, choose SampQuant.SampPerChan.  Wire through a "To I32" function and into the Samples per Channel of the DAQmx Read.
  • Go to Front Panel.  Drop a Waveform Chart.  Return to Block Diagram, put Chart inside the While Loop, wire output of DAQmx Read to Chart.
  • Run the code and watch three lines get plotted.  If you have real data on your USB-6009, you'll see it.  Otherwise, you can "fake it" with a suitable Random Number Generator and some Wait(ms) functions.

Bob Schor

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