LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a loop to run for a set time

2 more things I need help with now.

I'm using a waveform Chart to plot the readings Im getting. I would like to make the X-Axis Relative time. For example: If i wanted the program to run for 10 seconds, the first number would be 0 the last 10 and 1-9 in the middle. From searching most people sugest not using a Waveform Chart, but what should i use instead? The XY Express graph works but the plots aren't getting connected by lines.

My next question is: How do I put all this data recieved into an excel spreadsheet? I'm using LabView 8.0 and can't seem to find the "Write to Spreadsheet file.vi" Any other method i try I keep getting mismatch errors.

TIA.
0 Kudos
Message 21 of 41
(1,936 Views)

Not sure where you might have seen people suggesting to not use a chart. A chart is perfect for displaying data as it is acquired. To make the x axis show the relative time between samples, just give a look at the shipping example called real-time chart. To change the start time to be zero, just wire a 0 to the XScale.Offset property.

The Write to Spreadsheet File is right oon the top of the File I/O palette.

0 Kudos
Message 22 of 41
(1,931 Views)
I saw that example before and I'm looking at it now. But I don't really understand it. This is my attempt at duplicating the process.



0 Kudos
Message 23 of 41
(1,915 Views)

You've made a couple of mistakes. First, it looks like you copied the property nodes from the example into your block diagram. That's all right but you didn't link it to the chart that is in your VI. Right click on it and select Link to> and then select your chart. You'll have to change the data wired to the history property. Just right click on the property and select Create Constant. Second mistake was to wire the output of the Wait (ms). This is the actual millisecond value and not the time in milliseconds to wait. If you probe the wire you have, you will see the difference.

p.s. As a further refinement, you should wire the Time to measure control to the XScale.Maximum property.

Message Edited by Dennis Knutson on 08-23-2007 03:57 PM

0 Kudos
Message 24 of 41
(1,905 Views)
There are some serious problems with your code.
  1. You are constantly changing the multiplier as a function of the ms timer value (???). This will not produce anything meaningful. The multiplier will be your wait divided by 1000 and you can set this property once outside the loop. The multiplier will never change.
  2. If you want to have all data in the spreadsheet (this is NOT an excel file, but a plain ASCII table with tabs separating elements and newlines separating rows), you should autoindex at the loop boundary, else you only get the latest point pair.
  3. Your property nodes should probably be linked to the chart.

Here's a 60second cleanup attempt, maybe it can give you some ideas. You really should start with some basic LabVIEW tutorials though.

There are probably much better way to design such a program. It all feels rather clumsy.

0 Kudos
Message 25 of 41
(1,890 Views)
Made the corrections stated and now when I run the graph a straight line from (0,0) to (1:40,0) occurs and then the graph goes up and behaves like normal. The timing values on the X axis are not correct either but I'm thinking both these problems are related to each other so fixing one would solve the other?

Here is the current version:



EDIT: Posted this as the previous post was being made. I'll try the above's suggestions and report back.

Message Edited by Vikster on 08-23-2007 05:19 PM

0 Kudos
Message 26 of 41
(1,891 Views)
  • To clear the history, you shoud wire an empty array, no an array filled with zeroes.
  • Writing of the multiplier property belongs outside the loop.
0 Kudos
Message 27 of 41
(1,887 Views)
With the new version by altenbach the graph starts at 0 but the X-values are still wrong. I stried changing the scale and for 10 seconds .115 fits perfectly but when i use 60 seconds on the graph it come to to 1:02 minutes.

BTW Thanks for the help everyone I really appreciate it.
0 Kudos
Message 28 of 41
(1,883 Views)
Maybe your measurement takes more that 10ms?
 
Why don't you use a timed loop to get more precise timing. You get even a notification if the loop finishes late.
0 Kudos
Message 29 of 41
(1,879 Views)
I thought of something else actually. When the data gets saved to an Excel file using the write to spreadsheet file.vi it gets all the correct numbers and times. Is it possible to make the graph from the file?
0 Kudos
Message 30 of 41
(1,855 Views)