LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help - Invalid reference error when closing file

Solved!
Go to solution

Any ideas, anybody?

 

 

Could really use some help on this please Smiley Happy

 

0 Kudos
Message 21 of 22
(852 Views)

Saloutios wrote:

1. As you can see, I am using my digital outputs to turn on/off the relays controling the high voltage. The problem is that I would like to manually stop i.e sample A from acquiring data and having a low state to the relay controling the voltage of that channel. Still I wanna still run the test without interruption for sample B. How can I achieve that without having to create a different queue for each sample? 

 

Actually I never see anywhere that a false gets wired to those relays to ever turn them off.  Ultimately, what you'll have to do is build the true/false for the two outpus in the producer loop and remember there condition by way of a shift register between iterations.  Right now, you have a shift register, but you never use the original data because you are overwriting both values with the bundle cluster function.

 

2. When I am pressing the stop button, I get an error that the Dequeue function of the Logging data queue has lost the reference number. I know this is an issue with Queues but I am kinda confused of what I have read about it here. 

 

When you hit the stop button, the upper producer loop ends and the two release queue functions are able to execute.  Only problem is that you don't know whether you have anything left in the queues.  It is possible that the stop button is read as false in a consumer loop, the loop waits for a queue item.  The stop button is changed to true causing code to execute that will close references.  And even a queue error out.  A dequeue function could execute with the default datatype of an empty reference and the loop won't end until it has a chance to iterate around again and detect the stop value having been turned to true.  Basically, you could have race conditions between the read value of the stop button, the status of the queue, and the validity of the file reference that is stored in the queue.

 

I wouldn't close down any queues until the very last sequence of the program.  And I'd have the producer loops signal to the consumer loops when they should end.  And only have the file references get closed once you know that the consumer loops are done writing their data to a file.

0 Kudos
Message 22 of 22
(842 Views)