ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift register updates

Solved!
Go to solution

Hi,
question might be ridiculously obvious, but I am new to LabView software.
Why isn't the state of the Boolean 3 LED indicator updated every iteration but only on VI termination?LV.PNG

0 Kudos
Message 1 of 5
(795 Views)
Solution
Accepted by topic author JakubWaw

Structured Data Flow.
 - Node runs when all inputs available

 - Node returns outputs when it completes execution

Looking at the While Loop as a node, the output of the right shift register is not returned until Boolean 4 stops the loop. Then, Boolean 3 updates!

Check out this tutorial (especially the Dataflow Programming Section):
https://learn.ni.com/courses/labview-tutorial

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 2 of 5
(781 Views)
Solution
Accepted by topic author JakubWaw

It all follows the principles of dataflow, one of the core concepts of LabVIEW and the first thing you should learn.

 

  • Nodes only execute if all inputs have received data
  • Nodes only output data once they have completed.

In your case, the "Boolean 3" can only update once the while loop stops, before that, the output value is not defined.

A powerful side effect of all this is the fact that anything that does not depend on earlier code can run in parallel.

 

 

LabVIEW is a full features programming language, not an electrical circuit simulator or similar.

 

A few quick comments on your "program".

 

  • Give all your terminals reasonable names for code readability, help debugging, and avoid confusion.
    • "ms wait" instead of "Numeric"
    • "Inside LED" instead of "Boolean 2"
    • "After LED" isntead of "Boolean 3"
    • "Stop" instead of "Boolean 4"
  • Boolean 4 should be a latch action button instead of a switch, else it could be left on TRUE at the next run. Familiarize yourself with the various mechanical action settings.
  • Your shift register should typically be initialized (unless this is an action engine subVI), else it will start with whatever value it had from the previous run, i.e. not defined.
  • Waits typically don't change at runtime, so a diagram constant for the wait is more reasonable.
Message 3 of 5
(762 Views)

Thank you for all your comments on my code, but that was just an example, to illustrate my question - no factory will ever use it as a crucial component. 

So i guess your answer extends to all nodes, that would mean timed loops as well. Am I right?

0 Kudos
Message 4 of 5
(754 Views)

@JakubWaw wrote:

So i guess your answer extends to all nodes, that would mean timed loops as well. Am I right?


It applies to absolutely everything that has inputs and/or outputs! (structures, subVIs, terminal, primitives, etc.)

 

For an old very simple example, watch this video.

 

 

0 Kudos
Message 5 of 5
(741 Views)