<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Seneca5 Software Blog &#187; LabVIEW</title>
	<atom:link href="http://www.seneca5.com/blog/tag/labview/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.seneca5.com/blog</link>
	<description>Expert LabVIEW™ Development</description>
	<lastBuildDate>Mon, 06 Sep 2010 15:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>July User Group &#8211; Circular Buffer in LabVIEW</title>
		<link>http://www.seneca5.com/blog/2010/07/july-user-group-circular-buffer-in-labview/</link>
		<comments>http://www.seneca5.com/blog/2010/07/july-user-group-circular-buffer-in-labview/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 15:35:57 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[User Group]]></category>
		<category><![CDATA[example]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=562</guid>
		<description><![CDATA[Ludwik Kordas presented the concept of a Circular Buffer (CB) and various ways to implement it in LabVIEW. His presentation and example VI&#8217;s are included in this post. Definition An area of memory  used to store a continuous stream of data by starting again at the beginning of the buffer after reaching the end. A [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/CircularBuffer_Ring1.png"></a><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/CircularBuffer_Ring1.png"><img class="alignright size-full wp-image-564" title="CircularBuffer_Ring1" src="http://www.seneca5.com/blog/wp-content/uploads/2010/07/CircularBuffer_Ring1.png" alt="" width="132" height="151" /></a>Ludwik Kordas presented the concept of a Circular Buffer (CB) and various ways to implement it in LabVIEW.</p>
<p>His presentation and example VI&#8217;s are included in this post.</p>
<p><span id="more-562"></span></p>
<h3>Definition</h3>
<p>An area of memory  used to store a continuous stream of data by starting again at the beginning of the buffer after reaching the end. A circular buffer is usually written by one process and read by another. Separate read and write pointers are maintained. These are not allowed to pass each other otherwise either unread data would be overwritten or invalid data would be read.<br />
<a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/CircularBuffer_Ring1.png"><img class="alignright size-full wp-image-564" title="CircularBuffer_Ring1" src="http://www.seneca5.com/blog/wp-content/uploads/2010/07/CircularBuffer_Ring1.png" alt="" width="188" height="215" /></a></p>
<h3>Simple CB Models</h3>
<ul>
<li style="text-align: left;">FIFO: first IN first OUT</li>
<li style="text-align: left;">(first WRITTEN first READ)</li>
<li style="text-align: left;">Number of elements: n+1</li>
<li style="text-align: left;">Predefined # of elements: n</li>
<li style="text-align: left;">“n+1” element is forbidden for write/read pointers</li>
<li style="text-align: left;">Elements could be of any data type including arrays, clusters or even clusters of arrays of clusters</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/07/july-user-group-circular-buffer-in-labview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VIG Example &#8211; Stopwatch</title>
		<link>http://www.seneca5.com/blog/2010/07/vig-example-stopwatch/</link>
		<comments>http://www.seneca5.com/blog/2010/07/vig-example-stopwatch/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 19:35:06 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Functional Global]]></category>
		<category><![CDATA[VIG]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=535</guid>
		<description><![CDATA[A VIG or &#8220;functional global&#8221; is a LabVIEW VI that provides the features of a global variable while overcoming some of the down sides of an actual global variable. A function global uses uninitialized shift registers to maintain state information and a typedef function to select the mode of operation. This example implements a stopwatch [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/StopWatchScreen1.png"><img class="alignright size-medium wp-image-536" title="StopWatchScreen1" src="http://www.seneca5.com/blog/wp-content/uploads/2010/07/StopWatchScreen1-300x255.png" alt="" width="300" height="255" /></a>A VIG or &#8220;functional global&#8221; is a LabVIEW VI that provides the features of a global variable while overcoming some of the down sides of an actual global variable.</p>
<p>A function global uses uninitialized shift registers to maintain state information and a typedef function to select the mode of operation.</p>
<p>This example implements a stopwatch timer. You can use it to time up to 16 independent events in your application.</p>
<p>For more information on functional globals, check out these links:</p>
<p><a href="http://decibel.ni.com/content/docs/DOC-2143" target="_blank">Basic Functional Global Example</a></p>
<p><a href="http://decibel.ni.com/content/docs/DOC-12054" target="_blank">Functional Global Flags to Protect a Shared Resource</a></p>
<p><a href="http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/ps/10/sn/ssnav:dzn/q/%22functional%20global%22/ses/false/" target="_blank">Other &#8220;functional global&#8221; examples in NI Developer Zone</a></p>
<h4>Download the Code here:</h4>
<ul>
<li><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/StopwatchLV2009.zip">Stopwatch LV2009</a></li>
<li><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/07/StopwatchLV61.zip">Stopwatch LV61</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/07/vig-example-stopwatch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Certified LabVIEW Associate Developer (CLAD) Example Tests</title>
		<link>http://www.seneca5.com/blog/2010/06/clad-example-tests/</link>
		<comments>http://www.seneca5.com/blog/2010/06/clad-example-tests/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 21:14:21 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[User Group]]></category>
		<category><![CDATA[Certification]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=515</guid>
		<description><![CDATA[There was a lot of interest at our last group meeting about NI certification tests. The Certified LabVIEW Associate Developer (CLAD) is the first step in getting certified. The test shows knowledge of LabVIEW basics. If you have had the LabVIEW Basics class (now called Core 1) or if you have some real-life experience with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/06/testform.jpg"><img class="alignright size-thumbnail wp-image-516" title="testform" src="http://www.seneca5.com/blog/wp-content/uploads/2010/06/testform-150x150.jpg" alt="" width="150" height="150" /></a>There was a lot of interest at our last group meeting about NI certification tests.</p>
<p>The Certified LabVIEW Associate Developer (CLAD) is the first step in getting certified. The test shows knowledge of LabVIEW basics. If you have had the LabVIEW Basics class (now called Core 1) or if you have some real-life experience with LabVIEW, you might be ready. If you want to find out, there are some sample tests you can download from NI&#8217;s web site:</p>
<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/06/clad_sample_exam1.pdf">clad_sample_exam1.pdf</a></p>
<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/06/clad_sample_exam2.pdf">clad_sample_exam2.pdf</a></p>
<p><a href="http://zone.ni.com/devzone/cda/epd/p/id/5225" target="_blank">Certified LabVIEW Associate Developer (CLAD) Sample Exams</a></p>
<p><a href="http://zone.ni.com/devzone/cda/tut/p/id/4261" target="_blank">How Can I Prepare for the Certified LabVIEW Associate Developer (CLAD) Exam?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/06/clad-example-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>May 2010 NI User Group</title>
		<link>http://www.seneca5.com/blog/2010/05/may-2010-ni-user-group/</link>
		<comments>http://www.seneca5.com/blog/2010/05/may-2010-ni-user-group/#comments</comments>
		<pubDate>Sun, 09 May 2010 19:14:01 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Event]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[User Group]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=494</guid>
		<description><![CDATA[Ready, Aim&#8230; This month, Seneca5 will once again be presenting at the quarterly National Instruments LabVIEW User Group. Description Seneca5 will be presenting a technical demonstration on vision and motion. Using a Compact Vision System and a Firewire camera, users will interact with a video feed to control an aiming device. Demonstrates NI Compact Vision [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/05/Target.jpg"><img class="alignright size-medium wp-image-496" title="Target" src="http://www.seneca5.com/blog/wp-content/uploads/2010/05/Target-300x271.jpg" alt="" width="300" height="271" /></a>Ready, Aim&#8230;</h3>
<p>This month, Seneca5 will once again be presenting at the quarterly National Instruments LabVIEW User Group.</p>
<p><strong>Description</strong><br />
Seneca5 will be presenting a technical demonstration on vision and motion. Using a Compact Vision System and a Firewire camera, users will interact with a video feed to control an aiming device.</p>
<p><strong>Demonstrates</strong><br />
NI Compact Vision System, IMAQ vision software, servo control<br />
Lunch will be provided by National Instruments</p>
<p>05/11/2010 | 11:30 a.m. &#8211; 01:00 p.m.<br />
Manchesters Grill<br />
2121 T.W. Alexander Drive<br />
Morrisville, NC</p>
<p>It is an NI event and lunch will be served, so you do have to register (but its FREE!). Get more information and <span style="text-decoration: line-through;">register here</span><span style="text-decoration: line-through;">.</span></p>
<p><strong>You may also be interested&#8230;</strong><br />
Seneca5 hosts the regular meeting of the <a href="http://www.seneca5.com/blog/user-group/" target="_self">LabVIEW Advanced User Group</a> at our office each month.</p>
<p><img title="More..." src="http://www.seneca5.com/blog/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/05/may-2010-ni-user-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>April 2010 User Group Follow-up</title>
		<link>http://www.seneca5.com/blog/2010/04/april-2010-user-group-follow-up/</link>
		<comments>http://www.seneca5.com/blog/2010/04/april-2010-user-group-follow-up/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 22:28:42 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Event]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[User Group]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[Servo]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=465</guid>
		<description><![CDATA[We had a great meeting discussing motor control of all types. Thanks to all who attended. Many people offered information on websites and products they have used. I wanted to capture some of them here in case anyone wants to check into them: Motor drivers for hobby servos phidgets.com geckodrive.com seetron.com/ssc.htm (serial control of 8 [...]]]></description>
			<content:encoded><![CDATA[<p>We had a great meeting discussing motor control of all types. Thanks to all who attended.</p>
<p>Many people offered information on websites and products they have used. I wanted to capture some of them here in case anyone wants to check into them:</p>
<h3>Motor drivers for hobby servos</h3>
<ul>
<li><a href="http://www.phidgets.com" target="_blank">phidgets.com</a></li>
<li><a href="http://www.geckodrive.com" target="_blank">geckodrive.com</a></li>
<li><a href="http://www.seetron.com/ssc.htm" target="_blank">seetron.com/ssc.htm</a> (serial control of 8 hobby servos)</li>
<li><a href="http://www.parallax.com" target="_blank">parallax</a> (serial controller that Michael used in his demo)</li>
<li><a href="http://www.servocity.com" target="_blank">servocity</a> (good source for hobby servos and accessories)</li>
<li><a href="http://usdigital.com/" target="_blank">US Digital</a> (optical rotary encoders)</li>
</ul>
<h3>National Instruments Tools</h3>
<ul>
<li><a href="http://zone.ni.com/wv/app/doc/p/id/wv-873" target="_blank">Advanced Motion Using NI Compact RIO (video)</a></li>
<li><a href="http://zone.ni.com/wv/app/doc/p/id/wv-1421" target="_blank">Discover Virtual Prototyping with LabVIEW and SolidWorks (video)</a></li>
<li><a href="http://www.ni.com/linux/" target="_blank">LabVIEW / NI support for Linux</a></li>
</ul>
<h3>Other Items</h3>
<ul>
<li><a href="http://cnx.org/content/col10241/latest/" target="_blank">Free LabVIEW training course</a></li>
<li><a href="http://www.winehq.org/" target="_blank">Wine</a> (run Windows applications under Linux)</li>
<li><a href="http://appdb.winehq.org/objectManager.php?sClass=application&amp;iId=4556" target="_blank">Old version of LabVIEW running under Linux with Wine (maybe?)</a></li>
<li><a href="http://www.seneca5.com/content/project.php?id=2" target="_blank">Countertop template digitizer that I showed (with the really high count encoder)</a></li>
<li><a href="http://www.seneca5.com/content/project.php?id=6" target="_blank">Museum animatronic project that I spoke about, which used hobby servos (that wore out way to quickly!)</a></li>
<li><a href="http://www.seneca5.com/portfolio.php" target="_blank">More Seneca5 projects (shameless plug I know, but some of them are very cool projects)</a></li>
</ul>
<p>Any additions? Comment them here. This group works best when we share ideas!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/04/april-2010-user-group-follow-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Multicolumn Listbox Icons</title>
		<link>http://www.seneca5.com/blog/2010/03/better-multicolumn-listbox-icons/</link>
		<comments>http://www.seneca5.com/blog/2010/03/better-multicolumn-listbox-icons/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 02:55:00 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[LabVIEW]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=441</guid>
		<description><![CDATA[Previously, I posted a listbox control with improved icons. Some have asked if it can be used for multicolumn listboxes, too. Well, yet it can. And here it is. (Actually, you can just use the listbox control. Right click and select Replace. Replace it with a multicolumn listbox. The new multicolumn box will maintain the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/03/MulticolumnListbox.png"><img class="alignright size-full wp-image-446" title="MulticolumnListbox" src="http://www.seneca5.com/blog/wp-content/uploads/2010/03/MulticolumnListbox.png" alt="MulticolumnListbox" width="160" height="139" /></a>Previously, I posted a <a href="http://www.seneca5.com/blog/2009/08/better-listbox-icons/">listbox control with improved icons</a>. Some have asked if it can be used for multicolumn listboxes, too. Well, yet it can. And here it is.</p>
<p>(Actually, you can just use the listbox control. Right click and select Replace. Replace it with a multicolumn listbox. The new multicolumn box will maintain the improved icons.)</p>
<p>Download VI: <a href="http://www.seneca5.com/blog/wp-content/uploads/2010/03/MulticolumListBoxIcons2.0.zip">MulticolumListBoxIcons2.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/03/better-multicolumn-listbox-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic, Smautomatic</title>
		<link>http://www.seneca5.com/blog/2010/03/automatic-smautomatic/</link>
		<comments>http://www.seneca5.com/blog/2010/03/automatic-smautomatic/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 02:49:57 +0000</pubDate>
		<dc:creator>GrumpyOldMan</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[LabVIEW]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=326</guid>
		<description><![CDATA[When I head out to my work shed to build something with my tools, the tools I use are picked by one and only one person&#8230;me! That&#8217;s the way LabVIEW used to be, too, back in the good old days. Now it&#8217;s all about the young kids and their automatic tool selection. La-ti-da! Manual tool [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/02/automatictoolselection.jpg"><img class="alignright size-full wp-image-328" title="automatictoolselection" src="http://www.seneca5.com/blog/wp-content/uploads/2010/02/automatictoolselection.jpg" alt="automatictoolselection" width="145" height="154" /></a>When I head out to my work shed to build something with my tools, the tools I use are picked by one and only one person&#8230;me! That&#8217;s the way LabVIEW used to be, too, back in the good old days.</p>
<p>Now it&#8217;s all about the young kids and their <em>automatic</em> tool selection. La-ti-da! Manual tool selection was good enough for us, and it should be good enough for them too!</p>
<p>I don&#8217;t let my work shed tell me when to use a hammer and when to use a screwdriver! And if I ever get any of those new &#8220;power tools&#8221; I won&#8217;t want my shed picking those either!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/03/automatic-smautomatic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s LabVIEW, Stupid!</title>
		<link>http://www.seneca5.com/blog/2010/03/its-labview-stupid/</link>
		<comments>http://www.seneca5.com/blog/2010/03/its-labview-stupid/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 21:09:50 +0000</pubDate>
		<dc:creator>GrumpyOldMan</dc:creator>
				<category><![CDATA[Grumpy]]></category>
		<category><![CDATA[LabVIEW]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=313</guid>
		<description><![CDATA[In my day, we knew that LabVIEW was an acronym, so we spelled it with capital VIEW as God intended! We knew it because we were there when it was being made. Sure, the first versions of LabVIEW were icons chiseled on stone tablets, but we liked it that way! And there is one thing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2010/02/LVSepia1.png"><img class="alignright size-full wp-image-322" title="LVSepia" src="http://www.seneca5.com/blog/wp-content/uploads/2010/02/LVSepia1.png" alt="LVSepia" width="200" height="248" /></a>In my day, we knew that LabVIEW was an acronym, so we spelled it with capital VIEW as God intended! We knew it because we were there when it was being made. Sure, the first versions of LabVIEW were icons chiseled on stone tablets, but we liked it that way!<br />
And there is one thing for sure we knew: the VIEW in LabVIEW is an acronym, so it needs to be capitalized.</p>
<p>It is not Labview, LabView, or LABVIEW.  It&#8217;s LabVIEW!</p>
<p>Maybe we could never remember what the acronym stood for but we knew it was one.</p>
<p>Violent Inhuman Enormous Wildebeest<br />
Vital Inheritance Expense Withholding<br />
Virtually Idiot-proof Enhanced Whatchamagig</p>
<p>It doesn&#8217;t matter. It&#8217;s an acronym. Now you know. So spell it right!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2010/03/its-labview-stupid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice Threads</title>
		<link>http://www.seneca5.com/blog/2009/11/nice-threads/</link>
		<comments>http://www.seneca5.com/blog/2009/11/nice-threads/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 07:33:57 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=202</guid>
		<description><![CDATA[Multithread programming in traditional languages can be a challenge. The programmer is responsible for managing many things, such as: Separating logical tasks Avoiding race conditions Avoiding thread starvation conditions Managing communication between the threads LabVIEW, on the other hand, lends itself easily to multithreaded programming. In fact, if you follow the dataflow rules, multithreading will [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/VI-Server-Functions1.PNG"></a><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/Threads_RGB.png"><img class="alignright size-full wp-image-478" title="Threads" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/Threads_RGB.png" alt="" width="305" height="340" /></a>Multithread programming in traditional languages can be a challenge. The programmer is responsible for managing many things, such as:</p>
<ul>
<li>Separating logical tasks</li>
<li>Avoiding race conditions</li>
<li>Avoiding thread starvation conditions</li>
<li>Managing communication between the threads</li>
</ul>
<p>LabVIEW, on the other hand, lends itself easily to multithreaded programming. In fact, if you follow the dataflow rules, multithreading will happen <em>automatically</em> when LabVIEW finds the opportunity.</p>
<h3><span id="more-202"></span>Dataflow Programming</h3>
<p>LabVIEW follows a programming model called dataflow programming. Rather than writing a program in the form of Step 1, Step 2, Step 3, &#8230;, LabVIEW programs pass the data on wires. Any VI taking inputs must wait for all of its inputs to be ready before it can run. In the example below, Loop A must run before Loop B is able to run, because Loop A produces data that is used by Loop B. The data dependency controls the order of execution.</p>
<div id="attachment_216" class="wp-caption aligncenter" style="width: 466px"><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/loops_dependent.PNG"><img class="size-full wp-image-216" title="loops_dependent" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/loops_dependent.PNG" alt="Loops with a data dependency" width="456" height="140" /></a><p class="wp-caption-text">Loops with a data dependency</p></div>
<p>However, if we remove the data dependency, we no longer force the order of execution. LabVIEW gets to decide which loop will run first. But is it Loop A or Loop B? Actually, it is both. This is where LabVIEW&#8217;s automatic multithreading kicks in. LabVIEW will create multiple threads and run each loop simultaneously, one in each thread.</p>
<div id="attachment_217" class="wp-caption aligncenter" style="width: 466px"><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/loops_threaded.PNG"><img class="size-full wp-image-217" title="loops_threaded" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/loops_threaded.PNG" alt="Loops with no data dependency" width="456" height="140" /></a><p class="wp-caption-text">Loops with no data dependency</p></div>
<h3>Sharing Data</h3>
<p>Remember, LabVIEW can do automatic multithreading only because there is no wired data dependency between the two loops, so the next question is, how do we share data between the two loops?</p>
<h4>Local Variable</h4>
<p>The first way of sharing data between loops that probably comes to mind is a local variable. It provides a way for you to access the value of data without wiring, so it can indeed be used and still allow automatic multithreading. But there are some drawbacks to local variables: they can cause race conditions, they need to be initialized, they break the dataflow programming paradigm, so you should not get used to using them (if you are a LabVIEW purist, you would never use a local variable).</p>
<h4>Queues</h4>
<p>A better way to share data between loops is with a queue. One loop can send a message to the other with a queue without creating a data dependency. And the message is delivered in a more predictable manner than a local variable. A great example of this technique is the standard Producer/Consumer template.</p>
<div id="attachment_219" class="wp-caption aligncenter" style="width: 543px"><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/producer-consumer.PNG"><img class="size-full wp-image-219" title="producer-consumer" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/producer-consumer.PNG" alt="Producer-Consumer Template" width="533" height="371" /></a><p class="wp-caption-text">Producer-Consumer Template</p></div>
<h3>Spinning Off Threads</h3>
<p>Multithreading with multiple parallel loops is fine, but it takes you only so far. Take for example a program that needs to capture data from a DAQ card as fast as possible, handle the user interface at a medium rate to keep up with the operator, and log the data to a file as a background function. Using parallel loops, you cannot control the priority of the various loops, which means the file loop runs as an equal to the DAQ task. That will likely slow down the DAQ and cause data to be lost.</p>
<p>One solution is to put each of the loops into a separate VI and &#8220;spin off&#8221; each of those VI&#8217;s to run independently. You can control the priority of a VI (under <em>VI Properties-&gt;Execution</em>), so you can set the DAQ VI to be time critical and the file I/O to be a background task.</p>
<h3>How to Spin Off a Thread</h3>
<p><img class="alignright size-full wp-image-220" style="margin-left: 10px; margin-right: 10px;" title="AppControlPalette" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/AppControlPalette.PNG" alt="AppControlPalette" width="174" height="225" /></p>
<p>To run a VI as a thread, you can&#8217;t just call it as you would a normal VI. Normally, when a VI calls another, that VI suspends its execution until the sub-VI completes. That&#8217;s the opposite of the multithreaded operation we are after. To spin off a VI, we can make use of some of the <em>VI Server </em>VI&#8217;s. These can be found in the <em>Application Control</em> palette.</p>
<p>The process is not difficult:</p>
<ol>
<li>Open VI Reference</li>
<li>Invoke Node &#8211; <em>Invoke Run VI</em>, specifying to not <em>Wait Until Done</em></li>
<li>(Optionally) Invoke Node &#8211; Invoke <em>FP.Open</em> to show the front panel of the VI you are spinning off</li>
<li>Use a named queue to communicate between the threads</li>
<li>When the thread is terminated, use Close Reference to dispose of the reference to the VI</li>
</ol>
<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/11/VI-Server-Functions1.PNG"><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="VI Server Functions" src="http://www.seneca5.com/blog/wp-content/uploads/2009/11/VI-Server-Functions1.PNG" alt="VI Server Functions" width="536" height="144" /></a></p>
<h4>Priority</h4>
<p>When you spin off a thread, it will run with the priority specified in <em>VI Properties-&gt;Execution</em>. You can also set the <em>Preferred Execution System</em> to tweak performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2009/11/nice-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy Pop-Up Windows</title>
		<link>http://www.seneca5.com/blog/2009/09/easy-pop-up-windows/</link>
		<comments>http://www.seneca5.com/blog/2009/09/easy-pop-up-windows/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 17:57:30 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[LabVIEW]]></category>

		<guid isPermaLink="false">http://www.seneca5.com/blog/?p=196</guid>
		<description><![CDATA[You can make pop-up windows quickly and easily by using tab controls. By using tab controls, you can create the same visual effect and the same functionality as a pop-up window, but you don&#8217;t need to create a sub-VI. Since you never leave the VI, you don&#8217;t need to worry about passing information into and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/09/FancyPopUp2.png"><img class="alignright size-medium wp-image-197" title="FancyPopUp2" src="http://www.seneca5.com/blog/wp-content/uploads/2009/09/FancyPopUp2-300x175.png" alt="FancyPopUp2" width="300" height="175" /></a>You can make pop-up windows quickly and easily by using tab controls.</p>
<p>By using tab controls, you can create the same visual effect and the same functionality as a pop-up window, but you don&#8217;t need to create a sub-VI. Since you never leave the VI, you don&#8217;t need to worry about passing information into and out of the dialog, simplifiying the code.</p>
<p>While this technique may not be appropriate for every situation, it is a nice trick to have when you need a quick pop-up window.</p>
<p>Give it a try. An example VI is attached.</p>
<p>Download VI: <a href="http://www.seneca5.com/blog/wp-content/uploads/2009/09/QuickPopUp.vi">QuickPopUp.vi</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2009/09/easy-pop-up-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
