10-07-2014 06:05 AM
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.
10-07-2014 06:15 AM
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
10-07-2014 07:08 AM
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?
10-07-2014 09:14 AM
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.
10-07-2014 09:56 AM - edited 10-07-2014 09:57 AM
if you want the user to be able to select from a certain value set only, use enum or ring control...
10-07-2014 10:49 AM
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.
10-07-2014 09:41 PM
10-07-2014 11:13 PM
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:
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.
10-07-2014 11:24 PM
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.
10-08-2014 04:47 AM
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.