08-03-2021 09:10 AM
Hello to all,
I would like to acquire my analogue inputs and write them to a tdms file which is in a box (true/false) clocked every second. (See pdf below)
The problem is that the writing is not done and that my true case in which my writing is located never happens as well as my false case. It is as if my case was blocked and that no case works.
The other problem is that before I put in a cadence box every second, my excel file only records one sample line and I would like to be able to record the data every second in the same excel file.
08-03-2021 09:20 AM - edited 08-03-2021 09:22 AM
So I wouldn't generally suggest the method you're using at all, for a once per second case, but the difference between your pdf and the VI is that the PDF shows "1000..." as the case, and the VI uses just "1000".
This produces essentially a race, if you check at 999 and 1001, you will get the "Default" case both times (and never trigger the write). "1000..." allows any value of 1000 or greater.
With regards to the writing to a file only once, I suspect that you're probably writing every second, but replacing the file.
You can avoid this by using the Open -> [ Write in loop ] -> Close design, in which you open the file before the loop in which you're writing the file, and pass the file reference into the loop. Then use it in the loop to write your data (possibly with a Shift Register), and only once you've finished do you "close" the file reference.
Coming back to the first comment (re easier methods), you might prefer to instead control the speeds of your loops or acquisition and then write on every iteration (once per second). If you're acquiring at a much higher rate, you can implement some decimation between acquisition and storage.
08-03-2021 09:22 AM
You have no loop. So I'm left to assume you are using the Run Continuously button, which should only be used for debugging small VIs. In your case, this means the Feedback Node for the previous time is being reset each time the VI is ran.
So use a loop around your code.