02-03-2015 02:26 AM
But this works fine, check it out
02-03-2015 02:39 AM
02-03-2015 02:40 AM
, you overuse local variable
Local variables make copies of data buffers. When you read from a local variable, you create a new buffer for the data from its associated control.
If you use local variables to transfer large amounts of data from one place on the block diagram to another, you generally use more memory and, consequently, have slower execution speed than if you transfer data using a wire. If you need to store data during execution, consider using a shift register
02-03-2015 04:32 AM - edited 02-03-2015 04:35 AM
@karthiksudhir80 wrote:
thanks for your support, i used event structure and local variables and implemented this application which increments the counter when swittch 1 is pressed and decrements the counter when switch 2 is pressed, and glows a light when the value of the counter is greater than 0.
Do not attach pictures, attach a VI (or snippet). We cannot see what's in the other cases of the case and event structures.
As others have already said, your VI is inefficient, ugly, disfunctional, and overly complicated. You have race conditions because you read from and write to local variables in parallel. There is duplicate code. Your stop button does not work correctly, because you don't have a correctly designed event for it. You use incorrect representation for integer math (You need blue instead of orange).
Try something like the attached.
02-03-2015 11:36 AM
Thank you, I understand that i have to learn a lot about optimising the vi if i plan to continue working on labview