Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LabVIEW: What is the difference between the mechanical actions "Latch until released" and "Switch until released"?

Tags:

labview

In which situations should we use "Latch until released" instead of "Switch until released"?

According to LabVIEW 2011 Help:

Latch until released—Changes the control value when you click it and retains the value until the VI reads it once or you release the mouse button, depending on which one occurs last. You cannot select this behavior for a radio buttons control.

Switch until released—Changes the control value when you click it and retains the new value until you release the mouse button. At this time, the control reverts to its default value, similar to the operation of a door buzzer. The frequency with which the VI reads the control does not affect this behavior. You cannot select this behavior for a radio buttons control.

like image 651
Kamran Bigdely Avatar asked Aug 18 '13 22:08

Kamran Bigdely


2 Answers

The documentation explains it clearly enough. Switch Until Released changes the value until you release it. It is possible, however, depending on the complexity of your VI that you push a button and release it before the value is read. In this case there would be no action taken on the new value. Latch until released guarantees that the off/on transition is read at least once.

As for which you would use them for, it depends on your situation. For most buttons where a click initiates an action you would generally use Latch until released - these are buttons where users would expect to click the button to do something or to toggle something, etc. Using Switch until released in these cases would end up with some times where the user would click the button but nothing would happen.

Switch until released is generally used for real-time type controls where you would click and hold the button to sustain an action and then release it to halt the action.

As a general guide, you might think of Latch until released as ideal for discrete operations (one click, one action) and Switch until released for analog actions (action continues while the button is down).

like image 160
J... Avatar answered Nov 03 '22 02:11

J...


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

This is super useful when using event-loops-as-state-machines to transition programmaticly from one event (state) to the next.

like image 34
Austin Avatar answered Nov 03 '22 00:11

Austin