04-17-2013 02:48 AM
Hi all LabView rookie so go easy on me,
Basically I'm running a video in one VI using Windows Media Player and I extract the current position in the video using a Property Node which then writes this value to a double integer indicator. I want to share this indicator value across another VI whilst this video is running but I'm not sure how to do it. I'm pretty much using this to run the video:
https://decibel.ni.com/content/docs/DOC-25131
Thanks for any help.
04-17-2013 02:58 AM
Am I right in thinking Shared Variables might be the way to go?
04-17-2013 03:17 AM
You can simply go with a global variable if you are not doing any critical operation where you cannot afford data loss.
04-17-2013 03:20 AM
I tried the Global variable way but it won't wire correctly when I put the indicator in the Global variable VI, unless I'm doing it wrong.
04-17-2013 03:41 AM
Can you show how you have used teh global variable? (If you are going to post the vi please post it in 2011 version or just post a picture of your code where you have used the global variable)
04-17-2013 03:51 AM
Basically using the code in the URL I posted in the Opening Post I tried to connect current position straight to a global variable the vi of which just had a numeric indicator in. I can post the code if you like.
04-17-2013 04:01 AM
Yes. It would be better if you can show how you have tried connecting a global variable and what is the problem (2011 version please)
04-17-2013 04:14 AM - edited 04-17-2013 04:23 AM
Please find the VI as attached. I want to transfer the data from current position across to other vi's in a project, I'm not sure I am using the global variable correctly. As said I am fairly new to LabView. Many thanks.
I can't seem to post the project so I will send the main VI and control structure to run it. I want to get CurrentPosition as a global variable, I want to share it across VI's as the video plays.
04-17-2013 04:45 AM
Ok I think I've got the global variable to work but the variable only updates continuously showing the time if I run it continously. Also is it possible to synchronise VI's so they start running at the same time, I suppose I could add a delay to the first VI.
04-24-2013 04:16 AM
Dear cheemz,
Thank you for posting this to the user forums. I took a look at your code and can offer a couple of tips & tricks.
At the end of the code you can expand the merge errors function to handle errors from multiple sources. Note that the merge errors function does not concatenate errors; it returns the first error that it finds and if it finds no errors then it returns the first warning.
You should also place boolean controls inside their respective event structure to restore their latch mechanical action behaviour.
There may be a conflict from having the event structure timeout and the wait until next ms multiple function, so I would remove the wait until next ms multiple function from inside your while loop - it plays no role in the code.
You code does look very good though - well done!
As for the global variables issue - there is a chance that you can get race conditions with variables, so to try to mitigate this you should try to pass data around with global scope by using a functional global variable. It stores the data in an uninitialised shift register; https://decibel.ni.com/content/docs/DOC-2143
Since labVIEW is a dataflow language, a function only executes when all it's inputs have values and a function is only returned once all it's outputs have values. The best way to force dataflow is to use the error cluster, so you could have an error in and error out as terminals in your subvi and make this the first thing that your main VI does (pass the error cluster).
I hope this information helps and you are enjoying using LabVIEW.
Kind Regards,