LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Old and new value of value change event are same

I am using value signaling property node of ROI descriptor for value change event but the old value and new value of ROI descriptor are same.

The value signaling placed in timeout event. When I changed the ROI of Image from front panel the value change event should be executed and the old value and new value should not be same.

Is there any other way ??

 

I also tried by user event. I added value change event and user event in single event but I am not able to see the old value and new value.

 

Please suggest the solution 

I want ..........

"Whenever I change the ROI of Image the value change event of ROI descriptor should be executed"

Jasraj Rajpurohit
0 Kudos
Message 1 of 15
(4,815 Views)

Hi Jasraj,

 

using "value (signalling)" fires a value change event even when the data stays the same.

Simple solution:

Compare old and new data in the value change event and us e a case structure with the result.

Or only fire events when the data really change…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(4,812 Views)

Hi GerdW,

I have already tried this but I am getting old and new values same so how can I compare?? 

Jasraj Rajpurohit
0 Kudos
Message 3 of 15
(4,792 Views)

Hi GerdW,

 

It may be because of value signalling is placed in timeout event.

Jasraj Rajpurohit
0 Kudos
Message 4 of 15
(4,792 Views)

Hi Jasraj,

 

how can I compare?? 

Use a comparison function:

check.png

 

It may be because of value signalling is placed in timeout event.

Well, even then you don't need to fire an event with each timeout!

I guess your VI works exactly in the way you have programmed…

 

When you need specific help you should attach your VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 15
(4,786 Views)

Dear GerdW,

Use a comparison function:

When old value and new value both are same then comparison doesn't make any sense.

 

even then you don't need to fire an event with each timeout!

Where should I place value signalling ?

Jasraj Rajpurohit
0 Kudos
Message 6 of 15
(4,783 Views)

Hi Jasraj,

 

When old value and new value both are same then comparison doesn't make any sense.

When you want to avoid unneccessary code execution a comparison with a case structure makes a lot of sense!

 

Where should I place value signalling ?

Whereever you need it.

Did you read my comment above?

 

Without any VI you will only get generic answers on your generic questions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 15
(4,776 Views)

@jasrajrajpurohit wrote:

 

even then you don't need to fire an event with each timeout!

Where should I place value signalling ?


Events are primarily for user interactions. If you think you need to fire an event whenever a timeout occurs, it would seem more reasonable to place all that code inside the timeout event and it will execute at that time. If you also need to sometimes manually fire a value changed event, you can assign "timeout" and "value changed" to the same event case.

 

You really should explain what you are trying to achieve. Most likely there is a better solution overall.

0 Kudos
Message 8 of 15
(4,775 Views)

@jasrajrajpurohit 

The compare was suggested as a solution to something else, that fits the symptoms you describe. I think it was assumed that you want to do some action when the value changes. As the event is fired even when it doesn't change (e.g. by sending value (signaling) with the same value), you can prevent the execution of the task by comparing. If the values are the same, no need to execute the task.

 

I think your problem happens before that. You don't understand why the values are the same. The compare is not your problem.

 

It is hard to tell without looking at some code why you'd get the same value... I'd have a good look at the place(s) where the value is changed. maybe even make a dummy place where it is changed. See if a definitely absolutely sure change of value still produces the same values in the event structure.

 

Or post some code...

0 Kudos
Message 9 of 15
(4,764 Views)

Hi Jasraj,

 

Please suggest the solution 

I want .......... "Whenever I change the ROI of Image the value change event of ROI descriptor should be executed"

Simple: delete that "value (sgl)" property node in the timeout event!

Now your VI will only react on user interaction…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 15
(4,760 Views)