LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timer issue

Solved!
Go to solution

Hello,

 

I'm trying to create timer, but I have one issue...

VI in att.

Timer reach set value and give TRUE on indicator ''reached1'', but soon as get out of case structure it give ''FALSE''.. I missed something, but not sure what...

 

If anyone can take a look...

 

Thank you.

0 Kudos
Message 1 of 6
(1,216 Views)

Have you used the Highlight Execution? You will immediately see why.

Lucian
CLA
0 Kudos
Message 2 of 6
(1,176 Views)

Yes, I run highlight execution and everything seems to work ok, but in normal run mode doesn't work...

What I have missed?

0 Kudos
Message 3 of 6
(1,172 Views)
Solution
Accepted by topic author milan87

The code that you designed is strange, maybe you can describe what you want to achieve and we can help you design a better one.

 

You inner loop will execute only once because of the TRUE constant wired in condition but the outer loop will call the inner loop continuously. The executed case inside inner loop will be 0 and then 1 and then again 0 and 1 and so on. In case0 output of the boolean is not specified and the tunnel is set to Use Default If Unwired so reached2 and Timer reached are written with FALSE. In case1 you write reached1 with TRUE and have a delay of 50ms. The other two indicators will also be updated with TRUE after case1 is finished but because there is no delay afterwards and case0 is called immediately after, they will be written back to FALSE. Most of the time the code will stay in that case1 where reached2 and Timer are not updated and previous value written to them was FALSE.

Lucian
CLA
0 Kudos
Message 4 of 6
(1,153 Views)

Idea is that inner loop is used as subVI, like timer, which will be used in some tests.

Test itself has while loop, so it will run inner loop from the timer also.

That why I placed one iteration of inner while loop...

 

Yes, you solved problem. I added ''wait'' block to bigger while loop, and have response of ''Timer reached''.

So basically, value will be so fast returned to false without delay...

 

Thanks a lot.  

0 Kudos
Message 5 of 6
(1,145 Views)

@milan87 wrote:

Idea is that inner loop is used as subVI, like timer, which will be used in some tests.

Test itself has while loop, so it will run inner loop from the timer also.

That why I placed one iteration of inner while loop...

 

Yes, you solved problem. I added ''wait'' block to bigger while loop, and have response of ''Timer reached''.

So basically, value will be so fast returned to false without delay...

 

Thanks a lot.  


Adding a hard-coded "Wait" raises red flags with me, especially since you seem to be inexperienced.  You might want to show us your code so we can make sure there isn't anything lurking in the weeds to ambush you.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(1,110 Views)