07-25-2008 03:18 PM
I dont really know, I've just always used while loops so i figured i should use one 🙂
If I wanted to put a loop around the part that writes data to the file,
which loop would I use, and how?
Thanks,
Cory
07-28-2008 01:54 PM
I have attached my latest version of the said VI.
I have 3 "Write to Spreadsheet File" functions.
The first is to write any pertanent comments before any measurements are taken.
The second is to write all the column labels.
The third (theoretically) continually writes data as it is given from my attached instrument.
However, when I run the program, this goal is not achieved.
Do I need a loop around the third write function?
Or is there some error I made somewhere along the way?
- Cory
07-28-2008 02:11 PM
You don't understand the basics of a while loop I think. Your VI will write the comments, write the header, and do a single serial read. It will then stop. You have the status Boolean of the error cluster wired to the termination terminal of the while loop. The termination terminal is set to be Continue if True. The only way that the while loop will run more than once is if an error occurs. The status Boolean of the error cluster is false if NO error occurs. The only way you can get more than one acquisition is if you run the program from the start again or if you are using run continuous mode. DO NOT USE run continuous mode. Ever.
Change the termination terminal of the while loop to Stop if True and OR it with a front panel Stop button.
07-28-2008 03:28 PM
Change the termination terminal of the while loop to Stop if True and OR it with a front panel Stop button."
I think I need some combination of your idea with mine.
If I get rid of the while loop all together, the data only reads once.
If I change the termination terminal of the while loop to Stop if True,
the file is written correctly, but the data is displayed incorrectly.
If I leave the termination terminal as I had it,
the file is written incorrectly, but the data is displayed correctly.
I am now thoroughly confused, because the displaying and writing of the data is in the same part of my code.
How can one be working and not the other?
07-28-2008 04:37 PM
07-29-2008 02:06 PM
07-29-2008 09:12 PM
07-30-2008 02:37 PM
Well, I set the device so it will send data on an interval, which I set to 1 second.
I could put the read, and write to file in a timed loop, that iterates once per second,
but I'm worried the program and the device wont syncronize and I will miss some data maybe.
You said "how do you know that the first x number of bytes are for your first indicator, the next x number of bytes are for indicator 2, .etc"
I don't know how many bytes each piece of data is, however, I do know what line to expect it.
That is why I have a dozen or so of the "Index String Array" functions.
I just know where in the array each data SHOULD be....
No one ever taught me LabVIEW, I kind of taught myself.
This is also only my third month of using LabVIEW.
So if my methods are unorthodox, that is probably why.
I'm doing the best I can though.
07-30-2008 03:12 PM