04-28-2013 10:14 AM
Hi all,
I want to do a simple thing and getting stuck in it. I wish to achieve a logic in which a counter increments from 0 till say, 16 and after that it again resets to zero. I am implementing counter using "feedback node"(initialized to 0) and "increment by 1" function block.
This counter structure is placed inside a case statement; counter ought to keep incrementing its value till it turns 17 and after that case condition should turn false and overwrite the count value to zero. I am trying to handle that overwriting thing using local variable; I have made that "counter" indicator as local variable.
But the issue is once counter reaches 17, and case “false” condition executes, 0 is thus not written to that local variable.
What is the point I maybe missing? Or what is any other way to achieve this thing?
Snapshot of VI attached as reference please. Urgent help needed regaring this issue. Thanking in anticipation.
Regards
Solved! Go to Solution.
04-29-2013 01:26 PM
Hello aijaz,
The local variable actually is writting a 0 to the indicator. The problem is that when it does, on the next iteration, you will increment the feedback node, and the feedback node actually does remember what the last value was and it wasn't reset. What you could do is write the 0 to the feedback node. In this example code I do exactly that. Hope this helps.
05-05-2013 10:46 PM
Thanks alot for your valuable help in time. It worked out! Got busy to reply earlier.
Cheers!
05-09-2013 01:54 PM
Count will not proceed beyond 0 because
16 is always greater than 0.
Swop x nd y ( greater than icon) for the count to increment up to 16 before resetting to zero.
xseadog