LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Save & Recall setup

Hi Bob,
That's right, I have already settled that part so thanks alot! Smiley Happy

0 Kudos
Message 31 of 33
(426 Views)

I apologize, as this is the first time I've taken a look at your code.  If you learn a little more about LabVIEW, and understand (and utilize) the Principle of Data Flow, you will have a lot more success in writing LabVIEW programs that (a) you can understand, (b) we can understand, and (c) do what you want them to do instead of just doing what you tell them to do (they do that now, and it doesn't always work!).

 

Forgive me if I wear my Professor hat, but here are some Principles and their Applications:

  • Principle of Data Flow says that a body of code (whether a Loop, a Function, a sub-VI) does not start until all of its inputs have data, and none of its outputs have data until the Loop, Function, sub-VI, whatever finishes.
  • Data flows in "wires".
  • A corollary of the above is that any two structures (loop, frame, function, sub-VI, etc.) that are not "sequentially" connected by a wire (i.e. output from one going into the input to another) will, in principle (and to the best of LabVIEW's ability, in actuality) run at the same time, in parallel.
  • One of the best ways to force code to execute sequentially is to use the Error Line to "serialize" them.  You almost never need a Frame Sequence -- simply use the Error Line.
  • Learn to  use Shift Registers in While and For loops to serve as "local memory".
  • Share data between loops using Queues, Channel Wires, Global Variables, Functional Global Variables, etc.  Try very hard to avoid local variables (unless you are an Expert and really understand the dangers of Race Conditions).
  • Learn common LabVIEW Patterns. 
  • Learn how the Event Loop simplifies handling "button presses" and "parameter entry" on the Front Panel.
  • Learn how the State Machine, including the Queued Message Handler, enables breaking a big problem into managable (and potentially order-changable) steps.
  • Learn how the Producer/Consumer Design Pattern can off-load lower-priority "process the data" from time-critical data acquisition.
  • Learn how to create (many) sub-VIs to encapsulate discrete steps in your Project.
  • Learn how the LabVIEW Project Environment helps you organize and manage the (possibly hundreds of) VIs in your Project.
  • Dip your toes carefully into the Wonderful World of LabVIEW "Style".  Some starter principles include:
    • Try to keep your wires horizontal and straight.
    • Utilize the Error Line.
    • Try to keep every Block Diagram on a single laptop page.  An excellent way to do this is to replace a large block of code with a 32 x 32-pixel-sized sub-VI.

Your code is hard to read, thus hard to comprehend.  You do have multiple loops, and they are clearly not communicating well.  You also have a number of Express VIs, which can be useful, but can also provide an overly-simple code solution that can lead you astray.  It usually pays to learn the LabVIEW Principles behind the Express VIs and use those instead (the best example is the simplicity and power of DAQmx and Waveforms over the Dreaded DAQ Assistant and its Evil Twin, the Dynamic Data Wire).

 

Bob Schor

0 Kudos
Message 32 of 33
(414 Views)

The setup file created by the scope is a series of scpi commands, in labview read the file and index the 1st column and run into a for loop with a visa write. This will allow you to configure your scope with labview with a scope setup file

0 Kudos
Message 33 of 33
(261 Views)