View Single Post
  #11   Spotlight this post!  
Unread 17-11-2011, 23:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: How to go from simple working code to professional code

Quote:
Originally Posted by Boydean View Post
Global variables are bad. Don't use them. Although, if I recall correctly with Labview this is unavoidable...I think.
I agree with everything in the post, except for the global part. I'm not going to claim globals are the best overall mechanism for sharing data, but they have their place, they are simple to understand, and that makes them a reasonable place to start out. This is why they are used in the LabVIEW template code.

Just to be clear, LV has many other data sharing mechanisms, and it is not necessary to use globals. If you feel that you are ready for it, read up on queues, notifiers, rendezvous, occurrences, or perhaps the RT FIFO. Finally, the sharing I personally use the most often is the functional global -- a custom subvi critical section wrapper with just the read and write operations I need. You may be tempted to use events because you have heard about them elsewhere, but since they are primarily for UI operations, they are not appropriate for RT, and the notifier or FIFO is the equivalent choice.

Greg McKaskle
Reply With Quote