LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to suppress initial SV value change events

I am running LV 2016 with the DSC. The code uses shared variable value change events. When the event structure initializes, LV will fire each of the registered SV events one time with the variable's current value. I have been trying to get around this behavior with little luck. The attached code is what I have come up with so far. The curious thing is that is I run it with execution highlighting turned on, the code does what I want. However, if I turn off highlighting the initial events still fire.

 

Any ideas would be helpful, or if you have any thoughts on alternative means for getting to my goal that would be good too...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 1 of 4
(2,371 Views)

Try adding an explicit DataSocket Read after enabling value change events:

first_val_event.PNG

 

Edit: It seems like just adding a 500ms wait after enabling value change events also works, as alluded to by the execution highlighting. So maybe the DataSocket Read is just delaying things enough (it takes around 350ms).




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 2 of 4
(2,325 Views)

Can you use a "Flush Event Queue Function" function on the "event registration refnum" before it gets to the Event Structure and wire a zero to the "keep most recent" input?

 


0 Kudos
Message 3 of 4
(2,319 Views)

I know DSC enables the ability to set an initial value for each shared variable; do you happen to be using that property within the shared variable library that you have setup?  Not sure if that is tied to your issue or not, but I'm wondering if some implicit shared variable value initialization is happening within the NI Tagger service soon after the VI is run, and causing the event structure value change events to trigger.  I think the delay work-around that others have mentioned is consistent with that value initialization theory.

0 Kudos
Message 4 of 4
(2,294 Views)