LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialize queue

Solved!
Go to solution

I am working on a queued state machine setup. I am using a type def with all of my possible states in it as the elements of my queue. At the start of my program the queue needs to initialize with a specific order as shown in the snippet below. However, when I run the code and probe the queue at the end, I end up with 0 entries in my queue. Am I missing something? This is my first time working with queues in labview.

Enqueue.png

0 Kudos
Message 1 of 5
(3,176 Views)

Is another process dequeuing in parallel?  How are you checking to see how many items are in the queue?

 

Just as a convenience, it would be better to create an array of the tasks and enqueue inside of a FOR loop.  Be sure to use a shift register on the error and the queue reference.


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
Message 2 of 5
(3,172 Views)

You could create an Array constant of all those enums set in that order.  Wrap the Enqueue in a For Loop  and feed the array constant in with auto-indexing on the tunnel.  Use shift registers on the queue reference wire and the error wire for identical functionality.  Less diagram space.

 

EDIT:  I see that is what Crossrulz suggested by the time I had posted this.

 

So attached is the image.

 

Message 3 of 5
(3,160 Views)
Solution
Accepted by topic author MTHPCB

If you are probing the queue out wire that is a reference to the queue and not the queue itself.

For testing purposes use the Get Queue Status VI and probe the # elements in queue output.

0 Kudos
Message 4 of 5
(3,158 Views)

Don,

 

It looks like you were right. I was probing directly off of the queue itself, rather than using the get queue status vi. I tried that and it looks like my queue is being built properly. So now I just need to figure out which downstream process is not working correctly.


Thanks,

0 Kudos
Message 5 of 5
(3,099 Views)