Discusiones sobre Productos NI

cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

¿Por qué mi botón de STOP del loop no funciona?

¡Resuelto!
Ir a solución

Hola, buen día.

Me gustaría pedir su ayuda ya que cuando coloco el control de STOP para el control de un loop en cualquier proyecto, no me funciona, desde un simple loop hasta varios en paralelo, no funciona. Siendo que este activo para que se detenga cuando le llega un valor TRUE. 
A continuación, coloco un proyecto de ejemplo en el que tengo un botón de STOP y no detiene el proceso, así como las capturas de pantalla del problema.

La versión de LabVIEW que tengo es la LabVIEW 2018 myRIO Toolkit.

Me gustaría mucho que me pudieran ayudar a encontrar alguna respuesta a ello ya que no encuentro la solución adecuada.

Gracias.

Descargar todos
0 kudos
Mensaje 1 de 8
2.726 Vistas

Cuando escribes un programa con loops, especialmente en while loops es importante poner in wait time dentro del loop. En las 3 imagenes no hay nada que controle el tiempo de ejecucion por lo cual el programa va lo mas rapido que puede y no siempre ve el cambio del "stop" porque va demasiado rapido. Pon un wait time de al menos 100 microsegundos. Dependiendo con el proceso yo uso entre 100 y 500 microsegundos. Al hacer esto le das tiempo a la computadora y LabVIEW para poder captar el cambio de "F" a "T" en el boton de stop.

0 kudos
Mensaje 2 de 8
2.682 Vistas
Solución
Aceptado por el autor del tema Luis1827

It is incorrect to say that the button change is not seen because of the loop speed. But it is correct that a loop should have a small wait, just to save battery, and give other program a chance to do their thing. No need to spin a loop millions of times per second. Every 100ms is sufficient, so place a small wait.

 

The button is latch action, and it is guaranteed for LabVIEW to see the change.

 

You should use the run button, not the continuous run button. If you use continuous run, the VI automatically restarts from the beginning whenever the loop in stopped.

 

altenbach_0-1590096275063.png

 

Also turn off execution highlighting, else you might need to wait a few seconds for the button to be read.

0 kudos
Mensaje 3 de 8
2.643 Vistas

Estoy de acuerdo, de seguro estás usando Continous Run, el stop terminará el evento pero se volverá a ejecutar.

Para que lo veas crea un indicador para las iteraciones del Loop.

 

Altenbach, not even the language barrier can stop you!

=======
My Channel: https://www.youtube.com/@LV_Lab

0 kudos
Mensaje 4 de 8
2.639 Vistas

@AldhairGarza wrote:

 

Altenbach, not even the language barrier can stop you!


No barrier, just google translate chrome plugin.... 😄

 

altenbach_0-1590105580394.png

 

0 kudos
Mensaje 5 de 8
2.628 Vistas

Totally missed the continuous run! Although I will disagree a little on LabVIEW always seeing the stop button change. Depending on the mechanical option by experience I have had stop not function because my loop had no wait time and therefore not "see" the button switch. That is just my humble experience, then again you are a Knight and I am but a beggar in NI land.

0 kudos
Mensaje 6 de 8
2.601 Vistas

The only way the buttons can be missed here is if the loop is slow and the mechanical action is e.g. "switch until released" (like a car horn), so if the button is pressed and then quickly released before the terminal is read, the loop won't stop. For very slow loops it can even happen for "switch action", but you would need to hit it an even number of times). The faster the loop, the less likely this will happen.

Latch action buttons switch the terminal to the non-default value until the next time it gets read by the code, at which time the loop will stop and the value reset to the default, no matter the loop speed.

 

There are many other scenarios where the loop might not stop, for example if the terminal is outside the loop, the VI contains more than one toplevel loop (all need to stop for the VI to stop), or if the loop contains an infinite loop (image below) or some other things that prevents going to the next iteration (locked event structure, waiting for a queue, etc.). Another possibility is if the stop button is disabled..

 

For example this VI cannot be stopped by the stop button. Can you guess why? 😄

 

altenbach_0-1590163863715.png

 

0 kudos
Mensaje 7 de 8
2.592 Vistas

Thank you so much

Yes, my main problem was when I tried to run the program, always activated de continuous run button 😅 but I thought that I won't have any problem.
Regards

0 kudos
Mensaje 8 de 8
2.552 Vistas