el 05-21-2020 02:34 AM
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.
¡Resuelto! Ir a solución.
el 05-21-2020 09:19 AM
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.
el 05-21-2020 04:29 PM
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.
Also turn off execution highlighting, else you might need to wait a few seconds for the button to be read.
05-21-2020 04:56 PM - editado 05-21-2020 04:57 PM
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!
el 05-21-2020 07:01 PM
@AldhairGarza wrote:
Altenbach, not even the language barrier can stop you!
No barrier, just google translate chrome plugin.... 😄
el 05-22-2020 08:19 AM
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.
el 05-22-2020 11:12 AM
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? 😄
el 05-28-2020 06:33 PM
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