03-21-2011 05:53 AM
Hi I have a plot that occurs outside a whileloop, and another that is constructed inside the whileloop.
How do I get the plots to run synchronously in the same waveform chart?
I've tried looptunnels, I've tried shiftregisters but neither solves it.
Below is a picture of my attempt to get'em together.
Hoping for some help.
Kindest regards,
Lasse
03-21-2011 06:52 PM - edited 03-21-2011 06:56 PM
Just to clarify, you're defining a complete waveform and starting to write it outside of the while loop.
Then, while waiting for the write to complete, you acquire another signal asynchronously in chunks, adding data to the chart a chunck at a time.
Because you are using a chart (as opposed to a graph) your complete write waveform will added each iteration to the chart indicator.
(I'm compiling an installer at the moment so I can't provide a snippet to demonstrate right now. Give me another 20mins and I'll post again.)
What you could do first of all is use a waveform graph instead of a chart.
Then using a 'build array' on the 'Y' values, manually build the waveform of acquired data in a shift register and display it in your chart indicator.
03-21-2011 09:24 PM - edited 03-21-2011 09:26 PM
This should do what you requested, but it will keep adding data until you hit stop or memory is full.
You'd have to add some sort of data truncate function to limit how much history is displayed.
(The hidden case is 0, it adds the first acquired chunck of data to the shift register)
03-22-2011 05:24 AM
Dear Troy, could you explain your code a little bit?
- Where do you find the empty waveform? I found waveformconstant is it OK?
-Why do you index the case-statement for each while-loop iteration?
I am using Get waveform Components, Build Array and Build Waveform, but my Build array vi doesn't look the same as yours.
Lokk what I get:
Thanks again.
03-22-2011 05:01 PM
Waveform Constant is what I used, I just named it empty waveform so you knew it was empty.
I used the iteration terminal of the for loop as an input into the case structure because the first time it runs (case 0) will just grab the whole waveform and put it in the shift register. That way it gets the timestamp and dt values, then every iteration after that just builds on the Y array.
The broken wire is because your build array han't been set to 'concatenate'.
Right click on the 'build array' primitive and set it to concatenate.
Otherwise it builds a 2D array instead of a adding the two 1D arrays together.