Is there any chance to constantly update data inside a CIN while displaying this data in a VI at the same time? I know that I have to run the calling VI of the CIN code in a different execution thread than the VI for displaying the data. But how can I exchange data with a CIN whithout ending the execution of the CIN. Can I pass a Named Queue or a Notifier to a CIN?
Klaus Staehle Heilbronn Germany
-**** Posted from RemarQ, http://www.remarq.com/?a ****- Search and Read Usenet Discussions in your Browser - FREE -
> Is there any chance to constantly update data inside a CIN while displaying > this data in a VI at > > the same time? I know that I have to run the calling VI of the CIN code in a > different execution thread than the VI > > for displaying the data. But how can I exchange data with a CIN whithout > ending the execution of the CIN. > > Can I pass a Named Queue or a Notifier to a CIN? >
There are probably several ways to do this, but by far the easiest would be to treat the CIN as a function call that returns and is called again with new data. If you want to have some constantly running code that blocks on a mutex or a semaphore, then spawn that code the first time you need it in the CIN, and keep it running in your own thread.
Now the CIN enters, drops off the d ata in whatever structure you decide to use, and exits to get more data and return. Meanwhile the background thread can execute however you like and the only synchronization needed is a way to spawn it, a way to mutex the data dropoff, and a way to tell it to exit.
The background C routine that you spawn or fork is now totally independent of LV and could be used anywhere. The CIN portion is particular to LV, and is lightweight.
This of course is easy only if you know how to do it in C or C++. The easier route is simply to place the work in the CIN, spawn nothing, and let the diagram and CIN take turns. This approach is less sophisticated, but can be made to work quite well for a fraction of the effort.