01-31-2017 03:48 PM
Hi,
I made a VI earlier which grabs analog data and writes it to tdms file. Then second section of the VI reads the data from tdms file and write to my excel template. It was working perfectly fine.
Now, I am trying to use a relay to control pressure source for calibration where I am using this VI.
I have attached the screenshot for reference.
I added the small section for digital output within the while looks where it was gathering the analog data. I just need to turn this high when the value of one of my channels reaches 1.45. But now I am getting the error when the software finishes. Here is the error:
2553 |
The object refnum is invalid. The node that returned this refnum might have encountered an error and did not return a valid refnum. The storage this refnum refers to might have closed before the call executed. This error usually is the result of an error being encountered, such as failing to open a storage or looking for a channel that does not exist. Valid refnums become invalid when the storage they refer to is closed. |
I am not sure what I am doing wrong.
I appreciate any help. Thanks
01-31-2017 04:51 PM
1. You really should be creating the task before the loop.
2. You might have not properly chosen your line(s) to use with the control.
02-01-2017 01:09 AM
Additional comments:
3. Don't convert the boolean array of the comparison with "1.45" to a DDT wire. Don't use JoinSignal on this DDT wire. Don't connect the DDT wire to the selector of your case structure - it shows a BIG RED coercion dot… (The same applies for the loop stop condition!)
3a. STAY AWAY from conversions to DDT at all! Why do you need to convert a 2D array to DDT to SplitSignal to 1D array when there is a simple function as IndexArray?
4. Don't use the "default if unwired" case tunnel to output the DAQmx reference. The code behind the case/loop may/will fail…
02-01-2017 10:41 AM
Thanks Crossrulz. It did work after I initialized it outside the while loop.
02-01-2017 10:42 AM
Thanks GerdW for the suggestions. I will implement them into my code.