From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timing plot with loops

Hello community 

 

I am a beginner with labview ,I am writing a VI using a while loop to measure current in time and plot it using a graph. the time axis shows the number of iterations and not the time.

is it possible to plot the current with time and not with the number of iterations of the while loop in the graph?

how many iteration  while loop executes  per second ?

the same questions for For loop!

0 Kudos
Message 1 of 6
(2,046 Views)

The short answer is yes, it is possible, and actually easy. Just set your DAQmx (you are using DAQmx and not the DAQ Assitant express vi, right?) to output waveform data and connect that to your chart. 

Message 2 of 6
(2,027 Views)

To address several of the points you raised:

 

Do you know the distinction (in LabVIEW) between a Chart and a Graph?  Do you know that the Dreaded DAQ Assistant (and its Evil Twin, the Dynamic Data Wire) are "crutches" for LabVIEW beginners whom noone teaches how to use DAQmx?  [And if you have to ask "What's DAQmx", then never mind ...].

 

LabVIEW differs from other Programming Languages in its treatment of Time (there are two whole Palettes on the Block Diagram devoted to this, the "obvious" one and the one marked "Waveforms").  You want to learn about Waveforms ...

 

I assume you know the difference (besides appearance) between a While Loop and a For Loop, right?  ["It's just appearance ..."].

 

Bob Schor

0 Kudos
Message 3 of 6
(2,003 Views)

actually I am using the DAQ assistant. 

I understand that with the DAQmax it is possible and with DAQ assistant it is not.

0 Kudos
Message 4 of 6
(1,991 Views)

Oh, yes, you need to learn the Principle of Data Flow, which deals with Inputs (to a function or Structure, like a loop), timing (of Structures and Loops), and Outputs (from functions and Structures:

  1. Nothing Runs until all of the (wired) Inputs have data.  [The reason for "wired" is some functions have "default inputs" that don't require a Wire -- an example would be any function with Error In -- if you don't wire anything, it assumes you've wired "No Error"].
  2. No Outputs are available until the Function or Structure finishes/exits, at which point they all become available.
  3. For a Structure to "advance" (for example a Loop to finish its loop, or a Case element finish its "Case", everything inside must run and finish.

A corollary of the Principle of Data Flow is that two functions that share no common input or output will (for all intents and purposes) run at the same time (or as close as the computer can make this happen).  Think about this when you ask how many iterations the While Loop executes per second (use Principle #3).

 

Bob Schor

Message 5 of 6
(1,990 Views)

I would not say that it is impossible with DAQ Assistant, but DAQmx is much more powerful. Look at some DAQmx Analog Input examples. Also, if you haven't already, go through some basic LabVIEW tutorials.

Message 6 of 6
(1,962 Views)