LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Construction of XY graph

Hey guys,

 

I'm relatively new to LabVIEW and am struggling with the construction of an XY graph.  Here's what I'm trying to do:

 

Acquire a 400 kHz analog voltage signal and an ~1 kHz digital counter signal from a USB 6216

Display the counter value on the x axis and the voltage signal on the y axis of a graph.

 

I'm acquiring the signals and creating the counter and voltage arrays through a shift register, which all work fine.  I can get a normal counter vs time and voltage vs time graph to display the individual signals.  How do I combine these into a single graph?  I assume it has something to do with the large disparity in frequency between the two signals which makes the arrays different in length.  Is there a way around this? or a way of interpolating between data points to create equal length arrays?  Any help would be greatly appreciated.

0 Kudos
Message 1 of 13
(4,373 Views)

XY graph works with clusters : you have to put your X array and your Y array in a "Bundle" function (Cluster palette).

 

If you want your XY graph to be multiplot, put your clusters in an array (build array or index array functions).

 

Hope this helps

 

EDIT : and there is an interpolation function in labview in the mathematic palette : put your X and Y arrays (smaller signal), and put in Xi input the X array of you larger signal.

Message Edité par JDlabview le 06-07-2010 05:42 PM
Message Edité par JDlabview le 06-07-2010 05:42 PM

J.D.
French Labview beginner
N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers
0 Kudos
Message 2 of 13
(4,371 Views)

Thanks for the quick reply!

 

I've been trying bundle and build array as well as using the interpolation function but it keeps giving me incongruent data types.  I still cannot get the XY graph to accept both arrays.  I've attached a picture of my vi, hopefully this will help.

 

Thanks again.

XYgraph.JPG

0 Kudos
Message 3 of 13
(4,338 Views)

it tells you right there what the problem is. You are attaching a cluster of arrays. The sink is looking for just an array. Now, that array can be an array of clusters of arrays and it should work 😉 Make sense?! haha.

 

You need to first wire the bundle function into a build array function. Then wire that to the graph terminal. However, to let you know, the way you have it now (even if you use build array) will just plot one line on your graph(I think). It will plot the data from your top loop as the x points and the data from your bottom loop as the y points. Is that whta you want?

 

 

Message Edited by for(imstuck) on 06-07-2010 02:57 PM
Message Edited by for(imstuck) on 06-07-2010 02:59 PM
0 Kudos
Message 4 of 13
(4,329 Views)

haha yeah I figured as much.  I've tried build array with it too and it gives me a similar error.  I only want a single line on my graph, using one daq reading as the x axis and the other daq reading as the y axis.  Here it is with build array:

XYgraph2.JPG This error in and of itself confuses me 😛

0 Kudos
Message 5 of 13
(4,317 Views)

Well in that case, use the convert from dynamic data function which is in the functions palette. The graph doesn't except dynamic data so yo uwill have to convert it to doubles. And since you only need one plot, you no longer need build array. Just wire the cluster directly to the graph.

Message Edited by for(imstuck) on 06-07-2010 03:09 PM
Message 6 of 13
(4,316 Views)

Awesome!  No more errors!

 

But the xy graph doesn't update, it just sits blank and doesn't display a signal.

0 Kudos
Message 7 of 13
(4,302 Views)

It appears from your image of a tiny portion of your program that the graph is outside the loops.  It probably updates exactly once after the loops run.  If one of the arrays is empty or has only one point, the graph may look empty.

 

Please post your entire VI with some typical data saved as default so we can see what is happening (or not happening).

 

Lynn 

0 Kudos
Message 8 of 13
(4,293 Views)
Attached is my vi.  The counter, DAQ assistant, is just a digital timing signal and the voltage signal, DAQ assistant 2, can be an arbitrary -10 to 10 volt waveform.  Both loops are set to run continuously.
0 Kudos
Message 9 of 13
(4,285 Views)

With the DAQ Assistants and the dynamic data type I cannot really tell what is going on in your VI.  Put another waveform graph on the output of the multiply function in the top loop.  Run the VI until you have some data on both waveform graphs.  Stop the VI.  Go to Edit >> Make Current Values Default.  Then save the VI.  Post that VI.  It will have some data for us to examine.

 

Questions: 1. Why are you using string controls and indicators for numeric inputs and outputs?

2. What is the purpose of the shift registers?  You never use the left terminals.

3. Did you know that there is a built-in constant for pi in the Numeric palette?

 

Lynn 

0 Kudos
Message 10 of 13
(4,272 Views)