06-24-2013 12:53 PM
Hi, I am reading in 3 pieces of data every 10 seconds, and saving it using the Write to file function, along with a timestamp wired to the comments pin of the function. However, it looks to be that the first timestamp value is incorrect, and each piece of data thereafter is incorrectly labeled. If you look at my attachment, the first 3 time points in seconds (x_value) are 0, .007 and .113007, and the associated timestamp is 1:44:24, 1:44:33 and 1:44:33. Now, the next 3 time points in seconds are10.00057, 10.00257, and 10.07058 and the timestamps are 1:44:33, 1:44:43 and 1:44:43. The first timestamp of the second 3 points (1:44:33) should have been with the first 3. The time in seconds appears to be correct, but how can I make sure the timestamp is stamped to the correct data point?
Solved! Go to Solution.
06-24-2013 01:22 PM
I think you may be getting burned by waiting on the bluetooth connection. Since the read date time is independent of the bluetooth read, it executes as soon as the loop starts. If the bluetooth read takes ten seconds to execute (for example it has to wait on data), then the data time block executed long before the bluetooth read finishes.
Try placing a flat sequence structure around the Get Date/Time and Write Measurement File portion of your code so that the only wire coming into that structure the Voltage. See if that fixes your timing issue.
You can always create your own Get Date/Time vi with error terminals in order to use the error wire to enforce dataflow. That'd be a cleaner long-term solution than using the flat sequence structure.
06-24-2013 02:15 PM
You get the time in two different places, so of course they won't match. Try eliminating one and use the data from the remaining one for both.
06-26-2013 10:43 AM
Thanks, the flat sequence structure worked great.