From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue after adding digital output to the vi

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

0 Kudos
Message 1 of 5
(2,484 Views)

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.


GCentral
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 2 of 5
(2,447 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(2,420 Views)

Thanks Crossrulz. It did work after I initialized it outside the while loop. 

0 Kudos
Message 4 of 5
(2,405 Views)

Thanks GerdW for the suggestions. I will implement them into my code. 

 

0 Kudos
Message 5 of 5
(2,404 Views)