From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure help

Solved!
Go to solution

Hi,

 

Attached is a simplified version of my program, but here is the problem. I have labview update a string, so in the program string1 gets copied to string2. When string 2 gets changed, I want the event structure to turn a light on for 1 second.

 

This only works when I manually update string2, not when labview copies a value to string2. For example, change string1 and having labview update string2 does not trigger the string2 changed event, but if I manually type directly into string2, the light works as it should. 

 

Any ideas on how to change the event or properties so that the event structure picks up the value change when labview updates the string2 and not just I type directly into string2?

 

Thanks. 

0 Kudos
Message 1 of 8
(2,880 Views)

Use a property node with value signaling.Event (Value Signaling).png

 

A better approach would be to use user events. It is more flexible and easier to have lower level subVIs signal the UI of a change.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 8
(2,878 Views)

The string1 to string2 gets updated as before, with use of property node this time.

 

But, my data changed light stays on at all times. I think this is becuase the while loop keeps updating string1, which updates string2 even thought the value isnt changing?

 

What did I miss?

Thanks. 

0 Kudos
Message 3 of 8
(2,869 Views)

I cannot look at your VI. but make sure when you update the string that you use the Value signaling property node and not just a local variable or something like that. The value signaling property node will cause the event structure to fire an event.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 8
(2,865 Views)

Sorry, I attached a picture of my code. I think my new problem of the LED getting stuck on is due to the signaling property becuase every time the program executes the while loop, the value gets "changed/updated". I only want the event structure to go through once when the string truely changes, not keep running through. 

 

Thanks. 

0 Kudos
Message 5 of 8
(2,859 Views)
Solution
Accepted by topic author g_e_m_i_n_i

hi gemini,

 

when you fire an event in each iteration of your loop you will always have the LED switched on...

 

- Create a "string" valuechange-event that fire the string2...

- You don't need a Wait function when you use the timeout of the event structure...

- You should create a STOP button event too...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(2,847 Views)

What do you have in your timeout case for the event structure? This loop will run every second and write something to the value signaling property which causes the event to fire. and then repeat this until you stop the loop.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 8
(2,844 Views)

Thanks GerdW that helped a lot. 

 

I see I need to keep the value with signal property node going throughout my program. I'll have to clean my code up elsewhere, because for string1 instead of a user inputting text, its being filled by a RS232 port every second. So I'll have to change when my RS232 reads. Actually I'll have to make my RS232 read once only. Hopefully that'll work. Thanks again. 

0 Kudos
Message 8 of 8
(2,824 Views)