01-22-2025 11:07 AM
thanks for the info., but the case never executed!
01-22-2025 12:28 PM - edited 01-22-2025 12:31 PM
Use the "time has elapsed" boolean output to switch the case structure. (and yes, there are simpler solutions that don't require express VIs)
It is very unlikely (=impossible!) that the final elapsed time is exactly 300 and nobody should ever do equal comparisons on floating point values!
01-22-2025 12:28 PM - edited 01-22-2025 12:29 PM
It is NEVER a good idea to use an EQUALS comparison on floating point numbers due to rounding errors. Machine epsilon - Wikipedia
In your case, it's even worse since you have to wait on your DAQ to collect its data. You are just skipping over the 300. Why didn't you just connect the Time has Elapsed boolean to you case structure? The Auto Reset function defaults to True, so it should work as is.
Or, you could change the EQUALS to GREATER or EQUALS.
EDIT: Altenbach beat me to it. 😎
01-22-2025 12:34 PM
BTW, you should also feed the DAQ reference out the right side of the loop and close it. Just like you did with the file reference. 😉
01-22-2025 12:34 PM
your code will only execute when elapsed time is exaclty 300, if by any reason the loop time is different from that it will not execute.
As an alternative, take a look on the example I attached, you can modify and include part of that on your code.
At every time the the saving happens, you need to reset the elapsed time .
01-22-2025 12:46 PM - edited 01-22-2025 01:02 PM
@altenbach wrote:
(and yes, there are simpler solutions that don't require express VIs)!
and I typically use the high resolution time so we have units in seconds.
01-23-2025 01:29 AM
Thanks all for your help.
But I have this problem now "The application is not able to keep up with the hardware acquisition.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem."
Also, I would like to add headers.
01-23-2025 01:36 AM
I was connected the time elapsed with shift register in true case
but now is OK
How can I add headers?
01-23-2025 02:18 AM
You can write the headers before the loop, right after opening the file.
01-23-2025 02:31 AM - edited 01-23-2025 02:35 AM
Then how to wire it to the Write to Text?
Like this