LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa resource name Control Event Structure Value Change behaviour

Hi,

 

Please can someone explain the behaviour of this snipet/VI. I have had a look around but may have missed previous discussions.

 

The event structure is triggered when the selected value of the VISA control is the same as the current value of the  VISA control, -i.e. the control value has not changed... but the event structure behaves as though it has.

 

Obviously it is easy to catch this condition, that is not the reason for the post!

 

Thx,

Blue

 

 

VISA resource name Event Structure question.png

0 Kudos
Message 1 of 7
(1,923 Views)

@BlueTwo wrote:

...

The event structure is triggered when the selected value of the VISA control is the same as the current value of the  VISA control, -i.e. the control value has not changed... but the event structure behaves as though it has.

... 


The event is a "Value change" event as you can see, so the event fires when the value changes, no matter what the value is.

Certified LabVIEW Architect
0 Kudos
Message 2 of 7
(1,907 Views)

Actually, I find "Value change" a little bit confusing. IMHO, "Value set" would be more precise and let one realize that what's being set may be equal to the previous value.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 7
(1,897 Views)

The behaviour I see is:

1, Open VI

VISA resource name' control and 'OldVal' & 'NewVal' indicators are all blank.

 

2, Run VI

Select COM1 in the 'VISA resource name' control.

'OldVal' is still blank, 'NewVal' reads COM1

x=y? indicator is false.

VI stops running.

 

3, Run VI again

Select COM1 in the 'VISA resource name' control again.

'OldVal' now reads COM1, 'NewVal' still reads COM1

x=y? indicator is true (indicating the old and new values are the same, i.e. there has been no value change)

This means the act of selecting COM1 has triggered the event case, despite it being the same value (not a Value Change, as selected in the event structure case).

 

For comparison, the Enum in the example, does not behave like this, if the same value is selected the second time around, the Value Change event case is not triggered.

 

So the event structure seems to be handling the two control types differently.... my question is why...

0 Kudos
Message 4 of 7
(1,894 Views)

If you do the same with a String, it behaves like the VISA controls.

I'd guess it has to do with the ability to enter undefined/unknown values.

 

I made the enum a text ring (or menu ring) and allowed undefined values, but that didn't change the behaviour - so it's not just the ability to define new values. However, if I used the "Other" input and picked another number (I tried 5) then doing the same produces the same behaviour as the string or VISA control, not the enum/ring.


GCentral
Message 5 of 7
(1,881 Views)

So the event structure seems to be handling the two control types differently.... my question is why...


You are right, the two control types behave differently. Generally, LV controls generate a Value change event even when you set (type) the very same value. An exception to this rule are the controls having a numerical value that let you select from a list (Ring and Enum). On the other side, Combo boxes or VISA resource name controls also let you select from a list, but behave like a normal String control.

Why? I don't know. This may be irritating sometimes, although you will not lose any actual value change.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 6 of 7
(1,868 Views)

🙂 thanks Paolo, cbutcher,

So at least there is consistency in the inconsistency 😉 As you say, Value Set may be a better term to describe it.

Yeah, no loss of data & not hard to deal with.

b

 

0 Kudos
Message 7 of 7
(1,846 Views)