<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating 2 separate Main programs, passing values in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769832#M352575</link>
    <description>Thanks guys! I will go with the shared variable approach. Everything seems to be working right so far... Now, is there a way to lock the front panel of program (1) while program (2) is executing its specified event? Usually with event structures, there is a check box to "lock front panel VI until event case finishes". Is there a way to do this between different programs?</description>
    <pubDate>Sat, 30 Aug 2008 20:52:58 GMT</pubDate>
    <dc:creator>Newbie217</dc:creator>
    <dc:date>2008-08-30T20:52:58Z</dc:date>
    <item>
      <title>Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769772#M352531</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am in the process of a creating two sepearte main VI programs. Program (1) will be the program the user interfaces with and updates dynamically (using the front panel to change values, addresses, and states of power supplies, DMM channels, analog I/O, digital I/O, etc). Program(2) will be a separate program running through automated tests (current/voltage sweeps, data acquisition, etc). Normally I would like to incorporate both programs into a single VI, but the shear number of front panel controls and indicators makes it more practical to run separate programs on separate monitors (dual-screen setup). My question is, how do I go about passing the dynamic updates of program (1) into program (2)? For example, if I use event structures for both programs, and change the power supply voltage in program (1), how do I go about updating program (2) with this new value? From what I remember it isn't possible to have a program running and being used as a subVI as well. Any thoughts or recommendations? It would help tremendously to get this type of setup working. &lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2008 11:34:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769772#M352531</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-08-30T11:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769777#M352534</link>
      <description>&lt;P&gt;If I understand correctly...&lt;/P&gt;&lt;P&gt;You can&amp;nbsp;run one exe, one application, with two vis with their front panel open simultaneously.&lt;/P&gt;&lt;P&gt;You can pass the data through them with, functional globals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this what you need ?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2008 12:09:54 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769777#M352534</guid>
      <dc:creator>Pnt</dc:creator>
      <dc:date>2008-08-30T12:09:54Z</dc:date>
    </item>
    <item>
      <title>Re : Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769779#M352535</link>
      <description>I suppose functionnal variables, global variables or shared variables should do the trick. A search on the forums will return hundreds of references on the subject !</description>
      <pubDate>Sat, 30 Aug 2008 12:11:42 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769779#M352535</guid>
      <dc:creator>chilly_charly</dc:creator>
      <dc:date>2008-08-30T12:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769780#M352536</link>
      <description>&lt;P&gt;from what I understand, take a look at shared variables, &amp;nbsp;and on the main vi 1 &amp;nbsp;put a while loop aside from the event structure with the update of&amp;nbsp;&lt;/P&gt;&lt;P&gt;your indicators from the shared variables&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2008 12:15:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769780#M352536</guid>
      <dc:creator>jjcimon</dc:creator>
      <dc:date>2008-08-30T12:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769832#M352575</link>
      <description>Thanks guys! I will go with the shared variable approach. Everything seems to be working right so far... Now, is there a way to lock the front panel of program (1) while program (2) is executing its specified event? Usually with event structures, there is a check box to "lock front panel VI until event case finishes". Is there a way to do this between different programs?</description>
      <pubDate>Sat, 30 Aug 2008 20:52:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769832#M352575</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-08-30T20:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769954#M352634</link>
      <description>&lt;P&gt;Y&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;ou can use a simple boolean variable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;When it is set to true you will ignore every front panel activity&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2008 05:16:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/769954#M352634</guid>
      <dc:creator>Pnt</dc:creator>
      <dc:date>2008-09-01T05:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770483#M352862</link>
      <description>&lt;P&gt;I would strongly recommend you avoid shared variables and globals for this sort of application.&amp;nbsp; Neither are thread-safe and both will cause many problems due to race conditions.&amp;nbsp; You can avoid such problems by using a thread-safe storage mechanism.&amp;nbsp; The most commonly used is the functional global (aka LabVIEW 2 global, shift register global, or action engine).&amp;nbsp; I prefer to use single-element queues, since they are more scalable and work better with object-oriented design techniques.&amp;nbsp; You can find examples and information about both of these techniques on this forum, and both work well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let us know if you need more information. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Sep 2008 13:52:18 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770483#M352862</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2008-09-02T13:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770942#M353052</link>
      <description>I appreciate the heads up. I'm not exactly sure how to code the functional global as I have never used it before. To better clairfy the type of program I am trying to run, included are the (2) Main VI's I am trying to setup. The files were written with LabVIEW 8.5 and are currently setup using shared variables. How difficult would it be to switch over to functional globals from the code I already have written? Thanks.</description>
      <pubDate>Wed, 03 Sep 2008 00:19:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770942#M353052</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-09-03T00:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770943#M353053</link>
      <description>Here are the project and shared variable library as well.</description>
      <pubDate>Wed, 03 Sep 2008 00:20:01 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/770943#M353053</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-09-03T00:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/771186#M353139</link>
      <description>&lt;P&gt;Several things you can do to improve:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You are currently using a simple event structure for program execution flow.&amp;nbsp; You would probably be better off with an event driven, queue based task handler.&amp;nbsp; You can find a paper and example code &lt;A href="http://forums.ni.com/ni/attachments/ni/170/114240/1/LargeGUIApplicationsInLabVIEW.zip" target="_blank" title="Large Applications in LabVIEW"&gt;here&lt;/A&gt;.&amp;nbsp; This code also gives an old example of using semaphore locked functional globals.&amp;nbsp; While useful, the semaphores slow them down quite a bit.&lt;/LI&gt;&lt;LI&gt;Use VI Server to launch one of your main VIs from the other.&amp;nbsp; This should take place in your initialization code.&amp;nbsp; When you launch the second VI, you can pass it references ( e.g. a queue reference to a single-element queue "global" ).&amp;nbsp; This also ensures that your hardware is fully ready by the time the GUI which uses it is launched.&lt;/LI&gt;&lt;LI&gt;You can find examples of several types of reference objects &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=264865&amp;amp;query.id=6971#M264865" target="_blank" title="Reference Objects in LabVIEW"&gt;here&lt;/A&gt;.&amp;nbsp; The attached paper will also explain why you want to use single-element queues or action engines instead of globals or shared variables.&amp;nbsp; Use either the single-element queue or action engine approach to store your "global" data.&lt;/LI&gt;&lt;/OL&gt;If you need more information, let us know.&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by DFGray on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 09-03-2008&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 08:05 AM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Sep 2008 13:05:24 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/771186#M353139</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2008-09-03T13:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772440#M353671</link>
      <description>&lt;P&gt;Thank you all for the replies and suggestions! I realize I have a long ways to go, and a lot to learn before gaining enough insight to code effectively. Anyway, I am not too familar with using queues, action engines and some of the more advanced LabVIEW functions. I will have to look more into the sample code when I have some time. Meanwhile, I am trying to avoid using shared variables as was suggested. My first attempt to improve the program was to use the Server VI to call my second program from the main program. The current problem I am running into is that I am unable to come up with a clever way to exit the Event Structure of the second program, and still have the front panel of the first program retain its functionality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I really liked about the shared variable approach was that I could open (2) VI's independently and execute them. Both programs had Event Structures that waited for user interaction with the front panel, and exchanged/updated the values without affecting each other. When I try to use the Server VI to call my second program, I get stuck inside the event of the second program and cannot regain access to the first program. The way I am getting out now is to wire a True statement to the stop function so that the second program only executes a single time before returning to the main program. The problem now is that the second program is no longer event controlled, but a single execution. Any suggestions on how to best address this problem? The shared variable approach seems to make much more sense at this point...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2008 05:55:43 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772440#M353671</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-09-05T05:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772441#M353672</link>
      <description>Also including the (2) programs.</description>
      <pubDate>Fri, 05 Sep 2008 05:56:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772441#M353672</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-09-05T05:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772633#M353749</link>
      <description>&lt;P&gt;You got hit with a dataflow problem.&amp;nbsp; Your main VI is waiting for the subVI (your other front panel) to finish before it continues execution.&amp;nbsp; Fortunately, there is an easy way around this issue.&amp;nbsp; Instead of using the &lt;STRONG&gt;Call By Reference Node&lt;/STRONG&gt; to launch your second VI, use an &lt;STRONG&gt;Invoke Node&lt;/STRONG&gt; and set the method to &lt;STRONG&gt;Run VI&lt;/STRONG&gt;.&amp;nbsp; Set &lt;STRONG&gt;Wait Until Done&lt;/STRONG&gt; to FALSE and &lt;STRONG&gt;Auto Dispose Ref&lt;/STRONG&gt; to TRUE.&amp;nbsp; This launches the VI as an independent thread and returns control to your calling VI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to set your data value before running the VI.&amp;nbsp; Do this with another &lt;STRONG&gt;Invoke Node&lt;/STRONG&gt; before running the VI.&amp;nbsp; Use either &lt;STRONG&gt;Ctrl Val.Set [Flat]&lt;/STRONG&gt; or &lt;STRONG&gt;Ctrl Val.Set&lt;/STRONG&gt; to set front panel controls.&amp;nbsp; Note that this method is not dependent on the connector pane pattern, so is somewhat more maintainable.&amp;nbsp; However, it is slower than the &lt;STRONG&gt;Call By Reference Node&lt;/STRONG&gt; method.&amp;nbsp; In cases like this, it really doesn't matter. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I agree that the shared variable is easier to use up front.&amp;nbsp; However, it is not as maintainable in this sort of application as a LV2 global or single-element queue.&amp;nbsp; My experience has been that you either take the development hit up front to use a thread-safe reference object or a much larger debugging hit later, and then need to use the thread-safe reference object anyway.&amp;nbsp; Once you have done it a few times, it is much easier, especially if you make templates of your favorite design patterns. &lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2008 13:52:56 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772633#M353749</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2008-09-05T13:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating 2 separate Main programs, passing values</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772799#M353817</link>
      <description>&lt;P&gt;DFGray,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for all your help. It is much appreciated. I will revise my program and try what you suggested. Hopefully the extra work involved with overcoming the initial learning curve will pay off in the end. Cheers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2008 17:21:56 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Creating-2-separate-Main-programs-passing-values/m-p/772799#M353817</guid>
      <dc:creator>Newbie217</dc:creator>
      <dc:date>2008-09-05T17:21:56Z</dc:date>
    </item>
  </channel>
</rss>

