LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queues and Events

Solved!
Go to solution

Dear Friends,

 

I need a small sample program for the following scenario

 

I have a  Queue, Values should be read from the queue and it has to be send through serial port

 

1) The way of filling the Queue is Initially a set of string value will be filled (I can implement this part);

2) The user will insert some string to the queue with a  button click, If the user click one button say for example "A" should be enqueued to the queue, if another button "B"like that,

3) If the queue is empty It has to enqueue a set of string in a order for example "P", "Q", "R" and then in between  if the user click the button again (say for example "P" and "Q" are enqueued, just before R is sent, button was clicked)  it has to come back to the second step and finish it then go back to third stage

 

Since the event generation part is bit difficult for me, could you please anybody provide a basic sample application  for this (I'm using the version 8.0)

 

 

 

Thank you,

 

 

 

Best Regards,

Rathan 

0 Kudos
Message 1 of 5
(2,973 Views)
Hello Rathan,

I went ahead and posted an example that does what you were describing. I was unsure about whether you were looking to reset the idle command sequence when a user event occured. It would be very simple to change the behavior to implement this behavior.

Here is the example:

Communities: Enqueue Default Commands While Idle

Let me know if you have any specific questions about the code.

Regards,
Dan King

0 Kudos
Message 2 of 5
(2,948 Views)

Dear Dan_K,

 

I couldn't download the VI. What is the reason? Could you please send me the correct link to download?

 

Thank you,

 

 

Best Regards,

Rathan

0 Kudos
Message 3 of 5
(2,943 Views)

Wow Great Dan_K, 🙂

 

I'm expecting somewhat similar to what you gave, 

 

Further what I need is,

  1. I want to add some more button click events How to Do it (Could you please provide the steps to edit the code)
  2. and At the beginning (During initialization only) the  I want to upload certain set of string to the Queue, How to do it?

 
Could you please help me to do this?

 

 

 

 

 

Thank you very much for your timely help, 

 

 

 

Best Regards,

Rathan

0 Kudos
Message 4 of 5
(2,931 Views)
Solution
Accepted by topic author Pahee
Hello Rathan,

The easiest way to add extra events based on separate button clicks would be to duplicate the current event case that handles the single button click. You can follow the following steps to easily do this:

Duplicate the event case:
Duplicate Step 1.jpg

Choose the new control created in the duplication and the Value Change Event:
Duplicate Step 2.jpg

Move the new front panel control and rename the Label and/or Boolean text:
Duplicate Step 4.jpg

As far as sending a set of initialization commands (which is what it sounds like you are doing) you can simply add a for loop after the Queue is obtained, but before entering into the producer loop. By indexing the for loop by a predefined array of strings you can queue up the initialization commands before entering the producer loop. This gives you your initialization commands before allowing for user input.

Initial Command Set.png

Regards,
Dan King

0 Kudos
Message 5 of 5
(2,883 Views)