LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform graph repeats on every loop iteration

Solved!
Go to solution

Hi Guys,

 

I've had some great responses from you lot already so I hope you can help me once more!

 

I am now trying to simply take a voltage reading from a sensor I have, attached to AI1, and I've contructed a very simple waveform graph using a DAQ assistant. I have the terminal configuration set to RSE, the acquistion mode set to continuous sample, and the samples to read and rate set to a control on the front panel which I can control myself. All of this is within a while loop which is necessary to collect the data over time.

 

However, the problem I'm having is that for every loop of the while loop it seems to reset the graph, so my x axis never increases over time, what I ideally want it to do is to show results crossing from 0 to say 100 on the x axis, and then when it gets to 101 it will start again on the far left of the graph crossing to the right for another 100 data points (there's a term for this but I forgot it, sorry!). To be honest, this sort of makes sense as everything in the loop will be restarted, but having tried to take the graph out the loop it doesn't work, so I'm fresh out of ideas.

What I think I may have to do is to build the DAQ segments up manually (DAQ mx) and have only certain parts of them within the loop, although I can't be sure. I've tried various examples online and on the NI database (including acq&graph voltage-int clk which works nicely in the examples, but not with my application) but no luck as of yet 😞

 

If anyone can think of what the problem could be, then do please let me know. FYI the sensor is fibre optic if it makes a difference. I've attached the VI file I've made that doesn't really work...

 

Cheers!

Ritchie

0 Kudos
Message 1 of 10
(4,075 Views)

You have a few options here you can add an array to keep the graph or you can use a chart. See the attached VI.

Tim
GHSP
0 Kudos
Message 2 of 10
(4,074 Views)

Thank you very much, aeastet! It's getting late here in London, but I'll be testing this in 12 hours when I'm back at work.

 

Thanks again!

 

Cheers,

Ritchie

0 Kudos
Message 3 of 10
(4,070 Views)

Hi Tim,

 

Sorry I was unable to test this on Friday, I've only been able to get on it today. What you posted was very useful but I've still got a couple of problems. For the waveform graph I can't seem to set up a window for the data to move along. The start time (of zero) is always there so the graph gets more and more squashed up as time goes on. For the waveform chart I don't have that problem as I've been able to set the chart history length so that after 25 iterations it starts a new window of data on the graph.

 

Basically I just want to collect data for, say, 10 seconds, then the graph moves along like a window (so after 10 seconds the end of the graph goes onto 11, but the last digit on the x axis of the graph moves up to 1, always keeping a window of 10 seconds). What I'd also need is that in later time I plan to keep a record of all data collected (in an excel file or something, I have a bit of an understanding on how to do that) so I don't want to physically forget data, just for the graph to display the data in clear concise windows in real time.

 

Cheers,

Ritchie

0 Kudos
Message 4 of 10
(4,043 Views)

Can you post what you are currently doing so that I can help with an example that will fit your code?

Tim
GHSP
0 Kudos
Message 5 of 10
(4,040 Views)

Something like this would be your best bet.

Tim
GHSP
0 Kudos
Message 6 of 10
(4,036 Views)

Hi Tim,

 

That's exactly what I want! But there's a small problem in that the X axis doesn't increase anymore, it'll increase to whatever you set your 'graph history display' to, and then stop there (so 0 - 10 as the default, then will just stay static). Any way to fix this? If so that's spot on 🙂

 

Thanks very much.

 

Cheers,

Ritchie

0 Kudos
Message 7 of 10
(4,024 Views)
Solution
Accepted by topic author Ritchie888

Since you are using a graph there is no way to fix that. If you choose to go to an XY graph you could fix that problem. See the example below.

 

 

Sensor-1_BD.png

Tim
GHSP
Message 8 of 10
(4,013 Views)

Success! That did the job nicely, and in the process I learnt about all the other types of graph too! Double win!

 

Many thanks, Tim. Most appreciated!

0 Kudos
Message 9 of 10
(3,993 Views)

Glad I could help

Tim
GHSP
0 Kudos
Message 10 of 10
(3,985 Views)