Discusiones sobre Productos NI

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

Ayuda para crear un botón cronometrado

Hola buenos días, soy nuevo utilizando LabVIEW y también el foro (así que no sé tampoco si esta pregunta deba ir en este foro). Necesito ayuda para crear un botón que, al pulsarlo, active una cuenta que me indique cuanto tiempo lleva el botón encendido; después, cuando apague el botón, se detenga la cuenta y cuando apriete devuelta el botón que se reinicie el visor y vuelva a cronometrar el tiempo.

  Hasta ahora conseguí empezar a correr el tiempo cuando aprieto el botón pero esta lejos de lo que necesito. dejo mi proyecto para que lo vean y desde ya muchas gracias por su tiempo.

0 kudos
Mensaje 1 de 2
1.088 Vistas

Looks like you are a LabVIEW beginner and might even have text programming experience. You have a glaring race condition due to the overuse of local variables. For example, in the picture you are reading from the "Numeric 2" local variable instead of from the ticker but there is no way to tell if the local gets read before or after the terminal is written. You even use the wrong representation. Also your loops spins missions of second burning one CPU core at 100% even though the ticker changes much slower. Use a small wait. If you want seconds, use the high resolution relative seconds. No need to divide by 1000.

 

altenbach_0-1601227344106.png

 

See if the attached can give you some ideas. Study it well, especially the use of feedback nodes and shift registers to retain data between iterations.

 

  • The boolean comparison gives a TRUE if the button just turned on, resetting the accumulated time.
  • The subtraction gives the time elapsed since the last iteration.
  • The shift register accumulates time depending on the state of the button.
  • The loop spins 10x per second. Probably sufficient.
  • etc.

 

 

altenbach_1-1601227459090.png

 

 

 

0 kudos
Mensaje 2 de 2
1.038 Vistas