LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Queue to existing vi

Hello everyone

You have convinced me that I need to become familiar with Queue for my project. I am making this interface for interacting with a new piece of equipment in development. We would like to use it for automated testing as well which has not been added. Not everything works yet, but it mostly works.

 

I spent this last week watching training video's about Queue, and how various uses are implemented. I can not seem to fit that information, into my application. I tried using my current while loop, for the loop shown in the example but it seemed to just hang before it even got to the while loop.

 

What are your recommendations for implementation in my vi?

 

This time since the more info I give you, the better advice I get, I am adding the whole vi. Please let me know if I didn't do that part correctly.

0 Kudos
Message 1 of 28
(1,991 Views)

File -> New ... -> From Template -> Producer/Consumer (Events)

In the Consumer loop, place your Frame 1, VISA should go to this loop also.

The Producer loop will replace your Frame 0 where you'll use Value Change event on your Send button to queue up a command to the consumer.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 2 of 28
(1,980 Views)

First and foremost LOSE THE STACKED SEQUENCE and never ever use one again. If you find yourself reaching for a sequence stop and think about it because with a few rare exceptions there is always a better way.

 

Think State Machine.

 

========================
=== Engineer Ambiguously ===
========================
Message 3 of 28
(1,970 Views)

Let me give this a try, and that will tell me if I am understanding you correctly.

 

Thanks Yamaeda

Message 4 of 28
(1,967 Views)

This is the third time I have heard that stacked sequences are not good, which gives me pause. I have yet to hear of any reason yet, but it was easy to figure out their binary value to the states I wanted to switch from. Then realizing I could have many stacks was like upgrading to DOS 6.22, FANTASTIC!! 😉 Anyway give me a couple links or a quick brief, and It may help me after I figure this Queue thing out.

 

Thanks RTSLVU

0 Kudos
Message 5 of 28
(1,959 Views)

@Hobbs23 wrote:

This is the third time I have heard that stacked sequences are not good, which gives me pause. I have yet to hear of any reason yet,


Here are 3:

1.  They hide code.

2.  Sequence locals, to pass data from one frame to the next, you need a sequence local.  That means wires wind up running backwards.

3.  Sequences need to run to completion.  If you have a 20 frame sequence structure, there is no easy way to skip out of it at frame 10 and skip the remaining frames.

 


@Hobbs23 wrote:

t, but it was easy to figure out their binary value to the states I wanted to switch from. Then realizing I could have many stacks was like upgrading to DOS 6.22, FANTASTIC!! 😉


I don't understand what you are referring to by binary values in this situation or how sequence structures help that.

While DOS 6.22 was great, that was back in 1994.  Comparing sequence structures to 23 year old technology doesn't help your argument.Smiley Wink

Message 6 of 28
(1,950 Views)

Sequences are considered by many people a bad programming habit, since they make code less readable, and harder to debug. 

 

The only place they are really accepted is a single frame sequence full of property nodes or locals with an error cluster running through it to force timing.

 

It is better programming to use the Error Cluster or other wires and their data flow to enforce proper program flow. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 28
(1,948 Views)

@Hobbs23 wrote:

This is the third time I have heard that stacked sequences are not good, which gives me pause. I have yet to hear of any reason yet,

Because a stacked sequence:

  • hides code
  • is difficult to debug
  • makes it very cumbersome to hand over values from one sequence frame to the next one
  • is inflexible. Just think, that you have to abort your sequence in step 3 of 5, because an error occured. In a state machine, you would switch to your error handling case, in a stacked sequence ... OK, think for yourself
  • does not enforce you to accept the dataflow paradigm of LabVIEW.
  • and many more

Regards, Jens

Kudos are welcome...
Message 8 of 28
(1,944 Views)

Hello Yamaeda

 

In the template location you indicated:

 

File -> New ... -> From Template -> Producer/Consumer (Events)

 

In my LabView 2009, instead of "(Events)", it lists only "(Data)". Is this the same thing?

 

 

0 Kudos
Message 9 of 28
(1,936 Views)

The only difference is that the top loop don't have an Event structure for handling UI, you can easily add that yourself. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 10 of 28
(1,933 Views)