LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create an xy chart using two independent while loops?

Solved!
Go to solution

Hi everyone,

I am trying to develop a data acquisition program. In this program, I have two independent while loops that each output a number of type double each iteration of the loop. I am able to successfully create two independent waveform charts (data vs. time) for each of the loops when it is placed inside. However, I now want to create an xy chart of the live data (the output of one loop is x and the output of the other is y).

I am having trouble doing this because of the separate nature of the loops...when I try to pull data outside of the loops it (naturally) doesn't refresh with each loop iteration causing the xy chart to not work in the way I intend. Is there an easy way to fix this? If more clarification is needed, please let me know!

David

0 Kudos
Message 1 of 7
(3,242 Views)

Yes, more clarification is needed. Please attach your code to clarify.

 

I'll take a wag at it, though. It sounds like you are trying to pair X and Y data which happen during a single time chunk, then repeat, is this right? (If not, don't bother to read on.) If so, why not just use a single loop. If your VI is getting too big/complicated for comfort, just put the data-generating stuff into subVIs which run to generate a single data point, then stop, put them into a while loop and send the putputs to a graph or chart inside the loop. That way you won't extend your data trace until you get one and only one point from each subVI and things will stay synchronized.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 7
(3,234 Views)
Solution
Accepted by topic author drosen14

If the two loops are not synchronized,how exactly do you want to do the xy graph, where each point, by definition, must contain a value from each loop.

 

  1. updated when either value updates and combine with the last seen value of the other loop?
  2. update at a constant interval with the current value from each loop?
  3. .... many other possibilities.

 

#2 is easiest. Simply create a third loop with a suitable delay and graph the two values via local variables. You probably also should limit the chart history in some way. 

0 Kudos
Message 3 of 7
(3,212 Views)

Hi altenbach,

 

                         I am encountering a problem that says the DAQ is reserved. I know that you cannot run two DAQ Assistants in a single while loop. but how do i come about it?. I want to read load cell data and strain gauge data on the same XY graph. If i run them seperately, then it is working fine, but if i club them together it is giving me an error . Can you please tell me how to go about this. I need this thing up and running by the next week since i have my thesis defense the week after that. Your help will be greatly appreciated.

 

Thanks and Regards,

Manjunatha Prasad R

0 Kudos
Message 4 of 7
(3,088 Views)

Your message has nothing to do with the thread you posted in.

 

From your description, it sounds like you are getting error -50103.  Search the forums for that error message and you'll find your answer.

0 Kudos
Message 5 of 7
(3,070 Views)

@ManjunathaPrasad wrote:

Hi altenbach,


Sorry, this is not a personal answering service, so please post a new question in a new thread instead of hijacking an old, unrelated thread that is already marked as solved!

 

I am not sure why you are addressing this to me. When was the last time you saw me answering a DAQ related question? 😮

0 Kudos
Message 6 of 7
(3,051 Views)
Based on his previous posts, he had no idea how to start a new thread. He also asked the same question, got an answer, and then said it was working.

http://forums.ni.com/t5/Multifunction-DAQ/Zero-strain-readings-at-the-start-of-a-test-using-Daq-Assi...
0 Kudos
Message 7 of 7
(3,040 Views)