LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Data - Extract numbers from string and write to file

Try this vi.  I added code to write the stop command after the loop, then read back any returning data.  If no data is returned, then just deleted that part.  See comments on how to send the stop command.

 

I changed the format specifier to "R %o.3f".  This should take an input like "R -0.123" and output the value -0.123 to be written to the spreadsheet file.  I'm not sure what your original specifier string did, I'm not familiar with the /s at the end.  But maybe this is why you are having trouble writing the data.

 

 

- tbob

Inventor of the WORM Global
Message 11 of 13
(1,162 Views)

tbob,

 

The program you gave me seemed to take all the built up data from the inclinometers last runtime and download all the values very fast when I ran it (ie 1 minute worth of output is put into ~5sec of timestamps). It didn't seem to collect as it came out. I'm not quite sure where the different lies between the new vi and the one I was using with the "ancient" functions to make them work differently.

 

I have another question but this may warrant a different thread in itself. I have the inclinometer reading data in the attached VI via my old method, and a quarature encoder wheel hooked up running in a VI below it. Currently the data is written to two files with respect to time. Is there any way to make it so that these data streams are combined and write in a manner of time vs. (inclination and position)? I've tried to use the combine signals function and merge them into one write block, but was not successful in placing the write block in any of the case structures.

 

Thanks,

 

Steven Porter

0 Kudos
Message 12 of 13
(1,140 Views)

Steven P17 wrote:

tbob,

 

The program you gave me seemed to take all the built up data from the inclinometers last runtime and download all the values very fast when I ran it (ie 1 minute worth of output is put into ~5sec of timestamps). It didn't seem to collect as it came out. I'm not quite sure where the different lies between the new vi and the one I was using with the "ancient" functions to make them work differently.

 

 


If the inclinometer has been running since the last time you ran any vi, you will have a build up of data in the serial port buffer.  So when you run my vi, it will read all of this data at once.  The inclinometer must be started at the beginning of the vi and stopped at the end.  It is obvious that it had been running before the vi was run, hence the built up data.  Once the read has caught up, the data should be collected as it comes out.  Do not use your old method.  It does not stop the inclinometer at the end, which will cause another build up of data.  Run mine once and stop the vi by pressing the stop button.  The inclinometer should stop at the end of the vi.  Then wait a few seconds and run my vi again.  You should not see a build up of data.  If you do, the stop command did not work.

 

You are using parallel loops.  Combining the data would be meaningless since the two loops will not run at the same exact speed.  To show this, create an indicator for "i" in each loop.  You will see that they don't count up at the same rate.  Can you not put your counter function inside the upper loop?  If so, build an array with the two numerical data wires and write this to the measurement file.  Or write one data then the next with two writes to the same file.  Whichever method suits your purpose.

 

One word of warning.  You should put a delay in your loop to prevent LV from chewing up 100% of the CPU time.  This could cause problems.  Even a 0 delay would do.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 13
(1,129 Views)