10-09-2008 08:05 AM
RJay,
In a nut-shell.
never use a local if you pass the data with a wire.
If a wire will not do it, try a shift register.
If the data has to be shared between multiple loops a method of sharing a shift register between threads is an Action Engine as I discuss in this Nugget.
If you "data path" has a single "reciever, use queues to pass the data.
Locals can be used effectively if you need to write to a control but should not be used as a technique for sharing data.
I hope that helps,
Ben
10-09-2008 08:07 AM - edited 10-09-2008 08:08 AM
While we're on the topic of Local abuse.. To illustrate Ben's point, the code shown below could SHOULD have used shift registers instead of locals.
from: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=360264#M360264
10-09-2008 08:09 AM - edited 10-09-2008 08:09 AM
... there's more...
10-17-2008 12:33 PM
From: http://forums.ni.com/ni/board/message?board.id=170&thread.id=362300
Plus, there is more abuse in the code..
11-28-2008 10:03 AM
I downloaded a bit of sample code from a pump manufacturer which claimed to have the hardware 'drivers'. I thought I'd best take a look to be safe, but it was just a simple demo of how to use VISA to communicate over RS232. Fair enough, LV is very different to text languages so a demo is always nice and helpful.
HOWEVER, the VI which does all the communicating business is a 3 frame stacked frame structure which uses both local variables to pass the VISA reference and sequence locals to pass the error cluster through all the frames. Additionally, the 'first call' primitive is used to open the VISA reference first time through, but at no point is the close VISA reference called, leaving the LV RTE to free memory.
01-07-2009 11:13 AM - edited 01-07-2009 11:14 AM
We bought an old rig from one of our other sites with the intention of adding some post process processes to it. The accompanying hardware manual is thick, in depth and very well laid out with cross references that match up with each other and everything. It even includes the manuals for third party hardware - RS232, GPIB devices and such. My task is to add all the the extra functionality, and - hooray! It is supplied with the source code! Given the quality of the hardware manual, I was expecting the software to be of a similar standard. Ho ho ho, I think not....
There are dozens of Sub VIs and they all look like that. The code has been crammed into the view of a 1024*768 screen. All in all there are 331 Global variables, 188 local variables and 79 stacked or flat sequence structures,
01-08-2009 11:35 AM
01-08-2009 02:22 PM - edited 01-08-2009 02:23 PM
I like how there's a front panel control called "Gunk".
-D
01-11-2009 08:55 AM
03-17-2009 11:55 AM
Interesting way to split the error cluster. It doesn't show the entire code, but I bet the error clusters are joined using Locals.. Just a guess.. maybe..
http://forums.ni.com/ni/board/message?board.id=170&thread.id=393756