View Single Post
  #6   Spotlight this post!  
Unread 10-06-2010, 18:11
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Multiple Dequeue Element VIs in loop

Sorry for misinterpreting your question. Hopefully third time's the charm.

I changed my example to have a two loops instead of three like you're saying. In the "state machine" loop, I put two dequeue statements in parallel that update their corresponding outputs.

What I found was that when the iteration of the loop starts, both dequeue blocks are sitting waiting for data. When one queue gets its data, the second queue is still blocking. Unless that second queue data gets data, the first queue will never be dequeued again. This is because the loop iteration can't complete since everything inside the loop hasn't completed.

I was able to get this to work by doing the following
- On the timeout terminal of the dequeue block, add a constant of 1 (dequeue tries to get data for 1ms then gives up)
- Send the timed out terminal into a case structure. In the false case, put your processing of the data from the queue

What this will do is give each queue a chance (1ms) to process each loop of the iteration. If there is data waiting for it, it will be processed. If not, it wastes the amount of ms in the timeout. Chances are with the way Labview works, they will all happen in parallel since they're not dependent on each other, which means you shouldn't be wasting too much time in the timeout cases.

I can post a picture if you need me to.
Reply With Quote