LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem writing header info to continuously updated write file and starting time needs to be 0 every time I hit record button.

Solved!
Go to solution

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.

 

Download All
0 Kudos
Message 1 of 6
(3,509 Views)

@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.

0 Kudos
Message 2 of 6
(3,489 Views)

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.

0 Kudos
Message 3 of 6
(3,476 Views)

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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,473 Views)
Solution
Accepted by mksingh404

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. 

0 Kudos
Message 5 of 6
(3,472 Views)

Thank you for the suggestion. I will work on improving my Labview skills.

0 Kudos
Message 6 of 6
(3,451 Views)