06-02-2021 01:31 AM
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.
Solved! Go to Solution.
06-02-2021 04:22 AM
Have you used the Highlight Execution? You will immediately see why.
06-02-2021 04:30 AM
Yes, I run highlight execution and everything seems to work ok, but in normal run mode doesn't work...
What I have missed?
06-02-2021 05:11 AM - edited 06-02-2021 05:13 AM
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.
06-02-2021 05:27 AM
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.
06-02-2021 10:13 AM
@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.