LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you trigger event using value signaling property?

I am a begginer to LabVIEW and am having trouble using an indicator to trigger an event.  I have read alot of posts discussing using the value signaling property of an indicator to trigger an event when that indicators value is updated but I am still having difficulty getting my code to work properly. 

 

My code is supposed to read data files written to a directory and histogram and display data from them after some minor processing.  The vi should update the xy graph after each data file is processed and should (for now) re-run the histogramming and display code whenever a new data file gets written (by a separate system) to the data directory.  Eventually I intend to add code to add the histograms together and to only run the code (adding to the histogram) when a new data file is added to the data directory.

 

Hope that is a decent explanation and thanks for any help and tips.

 

0 Kudos
Message 1 of 5
(4,007 Views)

Hello,

 

Can you pls convert to the Labview 8.0 or 8.5 ver and re attach the VI.

0 Kudos
Message 2 of 5
(3,997 Views)

Several problems.  I'd suggest you execute your code with highlight execution turned on so you can see how it behaves.  You told us what you want the code to do, but you have don't us in what way your current code is not working properly.

 

1.  You have an event structure in the same while loop as another while loop.  That event structure can only execute once for each iteration of the big while loop.  You have to wait until your left hand inner while loop ends (by hitting the process button) before the event structure gets a chance to handle the next event.

 

2.  Every time that left hand inner while loop runs, you write the value of the data directory back to itself with the value signalling property on every iteration whether the value changed or not.  So another event gets queued up for the event structure, but it can't handle all of the events for the reason stated in #1.

 

3.  You have the front panel set to lock until that event case executes.  So your front panel probably freezes, and since you can't get the next event to execute until you hit the Processing button, and you can't hit the button because the front panel is locked, your VI look like it is locked up, but the left while loop is actually still running.

 

Event structures should generally be in while loops by themselves. 

0 Kudos
Message 3 of 5
(3,988 Views)

You're right, I hadn't stated the problem with the existing code but you hit the nail right on the head.  I originally had the smaller loop (the one that looks for new data files) outside the larger one, but that was not working properly so I tried putting it inside the larger one.  Taking it back out and looking at the highlight execution again, I see that it queues the events but then when the events are handled the DataDirectory2 indicator is the last file through the loop and the event structure plots the data from the same file over and over.  Do I need to take my event structure and place it in the same while loop as the code that looks for the data files and wire DataDirectory2 to the event structure?

 

 

Thanks,

 

Stephen

0 Kudos
Message 4 of 5
(3,961 Views)

Sure, I am attaching the file saved for LV 8.5.

 

Thanks,

 

Stephen

0 Kudos
Message 5 of 5
(3,959 Views)