LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enqueue Element in event structure only working on every other run?

Solved!
Go to solution

Hi All,

Any help would be greatly appreciated. I am trying to use an event structure to control the state of some heater relays via Boolean controls.

 

In order to do this I have created a Main vi. with an Event structure which when clicked runs a seperate vi that outputs the selected heater configuration, this array should then be written to a queue to be dequeued by a consumer loop.

The issue I am having is that the queue only seems to be writing the data every second time that I run the event?

 

On a second point that I have been thinking about as I am only setting the output to the consumer loop once does this mean that the consumer loop will only be able to run once? Would I need to place this data once dequeued into a shift register to facilitate multiple iterations of the loop. The consumer loop will eventaually have 5 PID outputs.

Once again any help is appreciated.

Thanks

Download All
0 Kudos
Message 1 of 4
(2,280 Views)
Solution
Accepted by topic author Alex.902

When using a queue you should only dequeue in one place. You are dequeuing in two different loops and that is why you are only seeing every other element. The other loop is consuming the missing elements.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 4
(2,268 Views)

Hi,

Thank you for your reply, I have removed a dequeue and that problem is solved.

Thanks

0 Kudos
Message 3 of 4
(2,261 Views)

I was just going to say the same thing. 😉 Also, there is absolutely no need for the bottom loop. Just wire the "element" indicator to the dequeue in the consumer loop (which you call "producer loop" for some reason ;)).

0 Kudos
Message 4 of 4
(2,258 Views)