LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queue does not get updated

The labview program uses both notifier and queue. When the gen_data button is clicked, the notifier sends out command to the second loop to generate data. After the data is generated, it will be sent to the queue. The third loop wait for the queue and once it received the data, display it.

 

The problem is that at the first time the gen_data button was pressed, the queue can get the data and update. But it will no long update any data in the future.

 

Thanks,

JJ

0 Kudos
Message 1 of 2
(2,204 Views)

Your code is highly flawed:

 

  • After one run, the stop indicator remains true for the next run, meaning the lower loop stops immediately because of the local variable..
  • Your lowest loop cannot stop, because you have a catch 22:
    • When you press stop and the dequeue is waiting, the loop can never spin and thus cannot complete.
    • In order for the lower loop to complete, the queue needs to be released, which requires the lower loop to complete.

 

Some ideas:

  • Get rid if that useles hidden stop indicator and place the stop terminal in the lowest loop instead.
  • Use the stop event to stop the uppermost loop using a "T" diagram constant in the stop case. No terminal needed.
  • Release the queue after the upper loop has completed.
  • Place the gen-data terminal inside its event case to properly deal with the latch action.

 

In the attached quick modification, I made sufficient repairs for the VI to work correctly as described above. Still, the VI is a total mess and needs to be refactored from scratch for a good solution. (There is also a small sequence frame to ensure that the latch action stop button gets reset)

0 Kudos
Message 2 of 2
(2,195 Views)