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

cannot stop while loop

¡Resuelto!
Ir a solución

 

Hello,

 

I want to count how many times the Boolean state has changed. But somehow the stop button cannot abort the statement.

 

0 kudos
Mensaje 1 de 8
4.869 Vistas

Study up on dataflow.

You're always going to be waiting in your inner while loops with this structure.

 

Look into Event Structures or using a Shift Register to track value changes.

 

Your polling while loops inside of another while loop will not work for your intended purpose.

0 kudos
Mensaje 2 de 8
4.863 Vistas
Solución
Aceptado por el autor del tema 416E64

Your code is way too constipated. Here's one simple solution.

 

 

Descargar todos
Mensaje 3 de 8
4.857 Vistas

 

 Emoticono sacando la lengua thx~

0 kudos
Mensaje 4 de 8
4.844 Vistas

@altenbach wrote:

Your code is way too constipated. Here's one simple solution.

 


 

Wiping coffee off my monitor now....

Sometimes you just know when someone's Freudian Slip is showing.Emoticono sorprendido


"Should be" isn't "Is" -Jay
0 kudos
Mensaje 5 de 8
4.830 Vistas

No slip. thats exactly what I meant.

 

(the stop will work after switching the boolean a few times, it's just a constipation issue. Impaired dataflow) 😄

0 kudos
Mensaje 6 de 8
4.823 Vistas

 

in the new attached file where i added "read digital input", 

how to use one single stop button to abort the whole program with two loops,

and how to set the default port as "port 1" but not "port 0"?

 

0 kudos
Mensaje 7 de 8
4.802 Vistas

All you need is a single loop (and stop button). Just place the code from the lower loop inside the upper loop.

 

Your current code is not stable because the lower loop might miss an update (race conditions!). What determines the loop rate of the upper loop? Is there some hardware timing or does the loop need a small wait?

 

You could even monitor multiple lines by tapping into the boolean array and maintaining an array of numeric in the shift register. The rest of the code basically stays the same.

0 kudos
Mensaje 8 de 8
4.796 Vistas