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: 

Timer counter does not update properly as called from SUB VI.

Hi,

 

I am having an issue trying to call a timer from a SUB VI. The timer counter works perfectly in a VI itself. However, when I make a SUBVI and call it in a new VI, the indicator does not update properly as a counter. It only updates at the end. Please check out the attached files.

Thank you for helping!!

Download All
0 Kudos
Message 1 of 3
(1,651 Views)

Of course it doesn't.  It's called dataflow.  A structure such as a node, a loop, case structure, or a subVI won't output data until the code inside of it is done executing.  Since you subVI has a loop, it won't return any data done the loop inside is done and it places all the data on the indicators.

 

Have you taken any LabVIEW tutorials?

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

0 Kudos
Message 2 of 3
(1,626 Views)

You need to start with a few simple tutorials and understand dataflow. A subVI will only return outputs once it is finished.

 

Run your Vis using execution highlighting to see how things work.

 

... also your subVI has a lot of questionable and unnecessary code, for example:

  1. Your sequence structure serves no purpose. delete it and nothing will change.
  2. A loop like that should have a small wait. There is no reason to spin it millions of times per second, consuming as much CPU as it possibly can.
  3. Boolean operations with diagram constants can be dramatically simplified. Look at the truth table.
  4. Your inner case structure serves no purpose. The output wire always mirrors the input wire exactly.
  5. The outer case structure makes little sense either.
  6. You did not include the subVIs, so we cannot test or comment.
  7. Never hide the label of terminals.
  8. Your main vi has no toplevel loop.

 

0 Kudos
Message 3 of 3
(1,625 Views)