01-21-2019 11:14 AM
Hello,
I am new to Labview and have problem in writing header info when writing data continuously from COM port.
It records data only when the record button is true and stops writing when record button is false. While running the labview file I have to write data file only when it's required (I might need to record more then 1 time while running the program). Second problem I am facing is with start time, every time I hit record button while program is running, record start time should be 0.
I am attaching the pic of the block diagram and Labview file.
Thank you for your time.
Solved! Go to Solution.
01-21-2019 11:59 AM
@mksingh404 wrote:
Hello,
I am new to Labview and have problem in writing header info when writing data continuously from COM port.
It records data only when the record button is true and stops writing when record button is false. While running the labview file I have to write data file only when it's required (I might need to record more then 1 time while running the program).
Second problem I am facing is with start time, every time I hit record button while program is running, record start time should be 0.
I don't understand your first problem, "it records data only when the record button is true". You have put your file writing code inside a case structure, and the true case will execute when the input is true.
For the second issues, you are facing an issue with "start time". I assume you are getting that from the tick count (ms) subtraction. If you want to reset that back to zero, you'll have to use a shift register and stuff the current tick count into it on the right side at whatever time you consider to be a reset.
01-21-2019 12:12 PM
Thank you for your response. Sorry for my english!!
In my first problem, I can record the incoming data in file. But problem is in adding header info for the recorded data (like time (sec), flow rate (nl/min)). I couldn't find a way to add the header info to the recorded data.
Thank you for your suggestion to my second problem, I'll implement it and let you know.
01-21-2019
12:16 PM
- last edited on
05-13-2025
03:50 PM
by
Content Cleaner
Some things to make your life a little easier:
1. There is a Mean PtByPt.vi that will do the moving average for you. You can eliminate a bunch of your code with that single VI.
2. Learn to use Format String function. It will make your numbers into a formatted string A LOT simpler, smaller, and possibly more efficient.
3. You can right-click on a Feedback Node and tell it to "Change Direction". It will make some of your wiring simpler.
4. No need for any waits in your loop. The rate of data coming into the VISA Read will limit your loop rate. No reason to force yourself to fall behind.
5. You may need to go with a Producer/Consumer if you find that writing the data to the file takes too long.
01-21-2019 12:18 PM
The easiest way to write the header is to write it before the loop, that way it will only get written once. It looks like you are using an "empty path" to signal that a new file should be created, so you could also put in a nested case structure so if the path is empty, it will write the header info.
01-21-2019 03:06 PM
Thank you for the suggestion. I will work on improving my Labview skills.