From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure and while loop

Good morning,

 

I have been trying to program a VI which controls the generation of an arbitrary signal which simulate the electrical activity of the hearth. For the selection of the amplitude of the signal I have placed an event structure which calls a dialog whenever the numeric control is clicked. The problem is that the program does not respond to commands such as STOP (even if I try to place it inside or outside the event structure), and I guess that the problem is given by the event structure. The subVI for the amplitude selection dialog works perfectly but it seem to loop inside this VI.

 

Thanks in advance for your help,

 

Best regards

 

Federico

 

PS: many elements are still not connected and I think that I am going to need more event structures.

 

Download All
0 Kudos
Message 1 of 12
(3,700 Views)

Just a guess but....

 

If you don't wire a timeout value to an event structure it will indefinitely wait. I'm guessing that's probably what is happening in your application....try wiring a timeout value and see if that helps...

 

Olly

0 Kudos
Message 2 of 12
(3,697 Views)

When that dialog is called, that dialog must complete before your loop can iterate.  Everything inside of a loop must complete before it can iterate.  What is this dialog supposed to do?


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
0 Kudos
Message 3 of 12
(3,683 Views)

The dialog is for selecting the amplitude since there is a defined set of values. As soon as you click on a value the dialog closes and sends out the amplitude.

0 Kudos
Message 4 of 12
(3,649 Views)

 if you want the user to be able to select from a certain value set only, use enum or ring control...

0 Kudos
Message 5 of 12
(3,637 Views)

I'd have to agree that the Ring control would be the better way to go.  I'd choose the ring over the enum in this case since you can actually set the output value to something non-sequencial and even floating points.


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
0 Kudos
Message 6 of 12
(3,619 Views)
Alternately, you could also make the dialog box a separate process that the event structure launches and then goes on. The dialog box could then update the event structure by firing a UDE (user defined event) when the operator closes the dialog.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(3,577 Views)

The image doesn't show the complete block diagram, particularly the terminals of the four buttons below the graph, i.e. Stop, etc... It is not clear what exactly is wired to the conditional terminal of the loop.

 

If the Stop terminal is directly connected to the conditional terminal of the while loop, then the Stop will work only if:

  • the Stop terminal is inside the Event structure in the 'stop:value change' event, or
  • the data flow has to force that its value is read after the event structure executes for a particular iteration, or
  • as Olly suggested already, you need to have a 'Timeout' event and something wired to the the timeout terminal of the event structure (not -1)

Otherwise the Stop button will work in best case when you click it twice, because at the time of the first click the conditional terminal of the while loop has already the FALSE value, and it was waiting only for the execution of the event structure. Your click will execute the event structure, but the conditional terminal of the while loop will see the TRUE value on the next iteration. So you have to click again, not necessarily the stop, in order to execute the event structure for a second time.

 

I personally would use producer/consumer with events in this case.

0 Kudos
Message 8 of 12
(3,556 Views)

As others told, enum or ring control is one of the Best Idea .

 

I’m not sure where you’re getting problem. Check this Sample VI.

If possible, give your code.

 

 

Munna
Download All
0 Kudos
Message 9 of 12
(3,546 Views)

Here is my code. It is ok to use the enum or ring but since I need to add more event structures I was trying to figure out what is wrong.

 

Thanks again for all the help.

0 Kudos
Message 10 of 12
(3,509 Views)