LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Elapsed timer subvi from another VI makes it behave differently

I have a SubVI with a Elapsed timer which checks input condition for 5 seconds and updates Indicator accordingly. It works fine as a standalone VI. But when I make it a Sub VI, the timer doesn't run and doesn't reset. Instead the timer keeps increasing .. I can't figure out what I am doing wrong. Need some help please

Download All
0 Kudos
Message 1 of 9
(4,242 Views)

Your subVI has a while loop.  That subVI will keep running until the while loop stops.  It will either happen immediately if the pitch and rol values you send in when the VI starts are false, then the while loop won't run.  Or if the pitch and roll values cause the while loop to run, then it won't stop until the elapsed time has passed.  Only then will the subVI stop and it will go back to the main VI.

 

Next iteration of the main VI, the while loop (if it runs) will not reset the Elapsed time timer because you have a false value on the  initializer of the shift register.  It will keep couning from where it left off.

 

Do you really want a subVI in that while loop?

 

Have you used the debugging tools like highlight execution so that you understand how LabVIEW works and the data flows?

0 Kudos
Message 2 of 9
(4,205 Views)

 

 

Hi Raven,

 

Hey I was just looking at it now with highlight execution and realized the false initialization everytime. 

 

I actually want it in a While loop for monitoring it continuously. And the while loop inside for checking fall condition for 5 seconds. Is there a way to fix this?

0 Kudos
Message 3 of 9
(4,200 Views)

What determines if it is a fall condition? The values changing in roll and pitch?

 

Those values don't change until the subVI ends because those values come from the main VI.

 

I suggest getting rid of the subVI and putting your code in the main VI.

0 Kudos
Message 4 of 9
(4,197 Views)

Roll and Pitch values actually change and I checked it. Please have a look, since the while loop in subvi stops in both conditions

 

But the problem I have now is the elapsed time

0 Kudos
Message 5 of 9
(4,191 Views)

Putting it in the main VI doesn't make a difference

0 Kudos
Message 6 of 9
(4,180 Views)

Why don't you also attach the code with everything in the main VI so we can understand what you define as "working correctly".

0 Kudos
Message 7 of 9
(4,160 Views)

Yeah sure..

Download All
0 Kudos
Message 8 of 9
(4,152 Views)

I haven't checked about the sense of the whole code. However, the "not resetting" issue is expected behavior. In fact, LV only does what you tell it to do with your code.

 

Point is, that you initialize the reset shift register with FALSE each time you call the subvi.

When the time elapsed, the value in the shift register is true. However, as you use that value as loop termination as well, the subvi stops without calling elapsed time with the reset TRUE.

In the next call, reset is FALSE because of your initialization.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 9
(4,116 Views)