LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

button don't stop system or routine

Hi everyone,

 

I have a system of adquisitation data from a device. The issue is that I have 2 buttons as a condition of 2 whiles different. When I pressed it, in the front panel, both of them don't stop the routine o the systems (depending of the button). I have one, to stop the receiving data from VISA (bottom that controls the while) and another for the while of all system.

 

I saw in high light that both of them turn no true, but only in this iteration... After that, cntinue doing the application.

There is an special menu for buttons? How can I stop the system (for example) pressing the button?

 

 

Thanks for your feedbacks!

0 Kudos
Message 1 of 15
(2,785 Views)

Hi mlop,

 

Can you post your code or a screen shot of your block diagram. It's hard to say what exactly is causing this problem. Probably one of the processes doesn't end when you press the button.


Regards,

Nitzz

(Kudos are always Welcome;))

 

0 Kudos
Message 2 of 15
(2,782 Views)

Hi,
thanks for your replay!What I want is that when I press Stop VISA, the funtion stop receiving data and the same for the other, when I press Stop system that labview finishes.


Attached you will find the .vi.


Hope you helps me!


thanks!

0 Kudos
Message 3 of 15
(2,765 Views)

Sorry, I dind't attached anything... Smiley Surprised

 

Here you are!

 

 

thanks!

0 Kudos
Message 4 of 15
(2,762 Views)

I was just asking you to attach it..:) so edited this post:)

 

 

 

0 Kudos
Message 5 of 15
(2,761 Views)

Hi Mlop,

 

I am sorry , I couldn't understand what you are trying to do in your code. Its not a very complicated code but you have to always keep your code neat and tidy. Arrange all the controls and indicators properly in the early phase of your development itself. 

I would suggest you go for a state machine and an event structure. Others in the forum may be able to give you better suggestion i think. The attached is the cleaned up code for others who can post some suggestions. 

 

qwer.PNG

 

Regards,

Nitzz

(Kudos are always Welcome;)) 

0 Kudos
Message 6 of 15
(2,752 Views)

Hi,

 

Just seeing the VI if you press the buttom of the Stop 1, it should stop the function (permanently) of the code inside the while, isn't it? and as well, if you press the buttom of Stop 2, the labview API should stops not?

 

Only, I would like to now if exist different functions if I press the buttoms Stop...because in high light mode, seems like when I pressed one time the Stop 2 (the condition that controls all the application), the condition comes True but, labview non-stop, so is why I don't undestand...

 

I hope you understand my question!

 

 

Thanks! 

0 Kudos
Message 7 of 15
(2,745 Views)

I'm sure someone else will add other suggestions/explanation, but here is my take:

 

I think you are probably expecting that the code will stop immediately when you press STOP, but this is not true.  In a While loop, the loop will stop after all the code inside executes. So, for your inner loop, it may take up to 5 seconds to stop after you press the button. As for the outer loop, if the inner loop is still executing, the outer loop will not stop until the inner loop stops first.  The While loop is like the old DO... WHILE statement - you have to get to the end before the program will decide to run another iteration or not.

 

Hope this helps.

 

Michael Tracy

Synergy Microwave

 

0 Kudos
Message 8 of 15
(2,736 Views)

You should be able to write this to use one loop. You do not need 2 loops. Even if you use 1 loop, do not place the VISA Configure and Close inside the loop. Configuration and closing should be done outside the loop. Initialize, loop around doing your stuff, when done close.

0 Kudos
Message 9 of 15
(2,729 Views)

@SynergyMike wrote:

The While loop is like the old DO... WHILE statement - you have to get to the end before the program will decide to run another iteration or not.

 

 


Sort of.  But there is one more thing to consider.  The stop button is usually read very early in the while loop.  So if you press the stop button while the while loop is executing, it is very likely that the while loop won't stop when that iteration ends because the stop button was already read as false.  Only after the next iteration finishes, during which time the Stop button has been read again seeing the True state of the button, will the while loop stop.

0 Kudos
Message 10 of 15
(2,728 Views)