04-05-2016 10:19 AM - edited 04-05-2016 10:20 AM
Should I move the destory queue to the consumer loop with the data writes? Doing that just freezes the program.
04-05-2016 10:24 AM
What I do is have the queue destroyed after the consumer loop completes. But you still need some way to tell the consumer to stop. The simple way would be to add a field in the cluster telling the loop to stop. When you see that field turn TRUE (I recommend a boolean), then stop reading and tell the loop to stop. The queue can then be safely destroyed and we can guarantee that all of the data has been logged.
04-05-2016 10:39 AM
My program is stopped in the first producer loop (VISA read loop) and then the error from that queue triggers stop cascades throughout the program while loops first to the data queue loop then (before i put in the FOR loop) to the data write loop. I can't seem to keep it that way now without getting a queue error. Not sure what you mean by add a boolean to the cluster, do you mean a local variable from the VISA loop that when it is true it sends a TRUE through to the data write loop and that gets parsed to the stop button in that while loop?
04-05-2016 10:52 AM
@crossrulz wrote:What I do is have the queue destroyed after the consumer loop completes. But you still need some way to tell the consumer to stop. The simple way would be to add a field in the cluster telling the loop to stop. When you see that field turn TRUE (I recommend a boolean), then stop reading and tell the loop to stop. The queue can then be safely destroyed and we can guarantee that all of the data has been logged.
I know what's wrong, I have a case structure to either record data (ie send it to the data record loop) or just display it on screen. So if the data record button is off (which it will be whenever someone is going to hit stop) the data record consumer loop never sees that the button was stopped and it just hangs. How can i tell it that the stop button was pressed (local variable?) without losing this "data record? " feature?
04-05-2016 11:27 AM
When your producer stops, send a command to the consumer telling it to stop.
04-05-2016 11:28 AM - edited 04-05-2016 11:50 AM
@crossrulz wrote:When your producer stops, send a command to the consumer telling it to stop.
How do I send a command to another while loop without using the queue? Got this by getting queue status before the for loop:
Was this the correct way?
04-05-2016 11:39 AM - edited 04-05-2016 11:51 AM
Also I jsut noticed that using the for loop in the data write loop continously writes zeroes to all columns when the data record button is turned off. How can I prevent that? I only want it to be recording data when the data recording switch is on, and do nothing without that. but the for loop is always running and just saying the queue has zeroes in it so it writes that.
04-05-2016 01:29 PM - edited 04-05-2016 01:29 PM
See if this gives you some ideas...
04-05-2016 04:23 PM
What is this symbol?
04-05-2016 04:48 PM
First is the Conditional Index tunnel that is on the loop. I think that came out with LabVIEW 2013, so you should have it.
Then there is the Empty Array? primitive. It is in the Comparison palette.