Search code examples
labview

Labview button freezes after pressed once


I'm trying to program something to read voltage from the Labview ULx library and add the voltage into an array. I tried to do so using an event structure while setting a boolean button 's mechanical action to "Latch when pressed". However, the "Latch when pressed" option seems doesn't work and the program reads the voltage and adds it to the array correctly and it freezes.

front panel

Block diagram: enter image description here


Solution

  • When you use a Value Changed event with a latched Boolean control, you need to read the control's value inside the event structure in order to reset the latch.

    Just move the Sample control's terminal inside the event structure, then it should work as you expect.

    Tip: you are free to use the Latch When Pressed action if you want, but the standard action for UI buttons in the OS (Windows etc) is actually Latch When Released. You can check this by clicking on a button, dragging the mouse pointer off the button and then releasing it - the button shouldn't operate. You might want to decide which one makes more sense for your application.