LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting one channel against another

Hi!

 

I am trying to create a program that will allow me to plot one analog input/output vs. another analog input/output (e.g. Force vs. Displacement or Horizontal displacement vs. Vertical Displacement) from two different channels from either the same data acquisition box or two different ones.  The goal is to generalize the program so that the user may choose if they want to plot an input vs. an output or an output vs. another output.  I am using a NI cDAQ-9127 USB DAQ chassis with NI 9205 modules.  Any help or ideas that could lead me towards a direction would be great.  Also, examples would be very helpful.  Thanks!

 

-Jefferson

0 Kudos
Message 1 of 11
(6,399 Views)

Hi Jefferson,

do you already have your data? You can use a graph or a chart to plot your data. For the selection you can use an event structre.

 

Mike

0 Kudos
Message 2 of 11
(6,390 Views)

Hey Mike,

 

I actually don't have the data.  I'm using a Data Acquisition Box to collect the data while the experiment is running.  So I need to be able to show the data in a graph while the experiment is running.  I tried using two of each DAQmx functions (Create Task, Create Channel, Timing, Start Task, Read, Stop Task, and Clear Task) and just connecting the output of the DAQmx read to the inputs of a Build XY Graph.  But the problem with this was that Labview gave me the error -50103, which states that "The specified resource is reserved".

 

-Jefferson

0 Kudos
Message 3 of 11
(6,368 Views)
If you had done a search for that error, you would have seen numerous posts on the exact same thing you have done. It is not at all correct to create two separate tasks (Create Channel, Timing, DAQmx Read, etc). You MUST use a single task. You simply have to specify multiple channels in your physical channel control. Click on the arrow on the right side and instead of selecting a single channel, click on 'Browse' and select multiple. You can also just enter the channel list. The format for continuous channels is Dev1\ai0:ai2 for channels 0,1,2 and Dev1\ai0,Dev1\ai2 for channels 0 and 2.
0 Kudos
Message 4 of 11
(6,355 Views)

Hi Dennis,

 

I have done a search for the error and I understand that I cannot use more than one task.  I also understand the naming of the devices.  My problem does not lie there.  Instead, it lies in the fact I need to plot an analog input measurement vs. an analog output measurement.  I don't want the x-axis of my graph to be in terms of time.  So if I can only use one task, how would I allow that task to be both an analog input and output?  Also, how would I build a graph that will accept the data from the input and output and plot it?  I was thinking I could use the Build XY Graph function but before I can test that out, I need to find a way for my VI to accept the input and output. 

 

I need to write a program that is general enough (if this is possible) so that the user decides whether they want to plot two outputs (e.g horizontal vs. vertical displacement) in a graph or to just plot one input vs. an output.  I don't mind creating two separate VIs (one for plotting two outputs and the other for plotting an input vs. and output).  From your response, it would seem that it is fairly simple to create a VI that could show two outputs in a plot.  But I still don't know where to begin on creating a VI to plot an input vs. an output. 

 

I apologize if I wasn't clear before.

 

-Jefferson

0 Kudos
Message 5 of 11
(6,347 Views)

Actually your problem does lie there because you aren't going to be able to get your VI to run until you get your DAQ VI's working right.

 

You can plot an input vs. and output.  Your input will come from the DAQ read.  Your output will be the data you feed to the DAQ write.  You will be able to do an X vs. Y on those two array wires.  Look in the example finder for more details on XY graphs and how to bundle the data.

Message Edited by Ravens Fan on 07-23-2009 11:47 PM
0 Kudos
Message 6 of 11
(6,343 Views)

Your problem was that you said you got a resource reserved error and that means you were doing two separate DAQmx Read tasks and that is what I based my answer on. If you want to do an analog input and an analog output, then of course you would use two tasks. Plotting an input versus an output will depend on how you are generating the output signal. In the simplest case, you provide an array to the DAQmx Write and you would wire up this array as well as the array from the DAQmx Read to the XY Graph. That's shown below. More details on what you are actuall doing for the analog out and analog in would help.

 

Input versus Outpu.PNG

 

For two analog inputs versus each other, you would use a multiple channel DAQmx read and separate the two channels and wire to the XY graph. For two channels versus time, you would wire the data from the multi channel DAQmx Read to a waveform graph. Depending on the user selection, the XY Graph or the Waveform Graph could be made visible/invisible.

0 Kudos
Message 7 of 11
(6,335 Views)

I am trying to display two plot one for Pressure and one for Flow using a PCI-6220.

Each Display (Plot) will have 4 inputs Channels A0 -A3 I have tried to use tha

I am new to Labview and have tried to build a cluster from examples I have found in labview but I am still having a problem getting the data there.

I am using the SCB-68 connect box and inputing 3 Pressure tranceducers, 0- 5 Vdc.

The code I tried to change was the Multi20XY, Not sure how to upload my code to this post.

I have tried to used the DAQ Assisitant but still can not get the code to run.

Any ideas of what I am doing wrong.

 

0 Kudos
Message 8 of 11
(6,232 Views)

Please start a new thread rather than hijacking someone else's thread.

 

It looks like you have few problems.  Only one of them is building the chart.  The others are your acquisition (Do you really want to acquire100 samples 100 times?  An array of dynamic data (the output of your inner most loop) isn't really a meaningful data type.  And also the overall structure of your loops and architecture.

0 Kudos
Message 9 of 11
(6,228 Views)

Hi sir,

      i was trying to create a graph for 16 channels each channel should be displayed in the x-axis or y-axis(we should select which channel should be displayed in the x or y axis) can you give me a clear example for that, i need to submit it in two days)ex: Ch 1 in y -axis and ch-2 in x-axis or ch 2 in y-axis and ch 1 in y axis we need to swap the graph. it was really urgent.

0 Kudos
Message 10 of 11
(5,234 Views)