LabVIEW: What is the difference between the mechanical actions “Latch before release” and “Switch until released”?

In what situations should I use Latch Before Release instead of Switch To Release?

According to LabVIEW 2011 Help :

Latch before release - changes the control value when you click on it and saves the value until the VI reads it once or you release the mouse, depending on which one happens last. You cannot select this to control the switches.

Switch until it is released. - Changes the control value when you click on it and saves the new value until you release the mouse button. At this time, the control returns to its default value, similar to the operation of a doorbell. The frequency with which the VI reads the control does not affect this behavior. You cannot select this behavior to control switches.

+6
source share
2 answers

The documentation explains this quite clearly. Switch Until Released changes the value until you release it. However, depending on the complexity of your VI, you can press the button and release it before reading the value. In this case, no action will be taken on the new value. Latch until released ensures that the transition from on / off is read at least once.

How you use them depends on your situation. For most buttons, where a click triggers the action that you usually use Latch until released , these are buttons in which users would have to click a button to do something or switch something, etc. Using Switch Until Released in these cases would end up with some when the user clicked the button, but nothing happened.

Switch Until Released typically used for real-time controls, where you press and hold a button to hold the action, and then release it to stop the action.

As a general guide, you can think of Latch until released as ideal for discrete operations (one click, one action) and Switch Until Released for analog actions (the action continues until the button works).

+6
source

Another big difference is that Switch When Released and Switch When Pressed events can be Val(Sgnl) using the Val(Sgnl) node property.

This is very useful when using the event-loops-as-state-machine program cycles to programmatically transition from one event (state) to another.

+1
source

Source: https://habr.com/ru/post/951982/


All Articles