08-16-2016 10:38 AM
Hi Everyone,
I wanted to create a simple counter with a Start Button and a Stop Button. Here is my VI currently and I'm somewhat stuck. I read that you don't want to create a while loop inside an event structure. I was wondering what is another way for me to implement this simple counter with a Start and Stop button.
Thanks for your help
B
08-16-2016 11:08 AM
I have modified your vi to what i understood:
-I have never seen someone telling using whiles loop inside event structure.
-Below code whenever you click on Increment it increments by 1.
-Remaining time it'll be waiting for an event to happen here either Stop or increment events.
08-16-2016 11:19 AM
Based on your VI, you are missing even the most basic principles in LV. I would suggest to take some available tutorials. Also, do not start with Event structure at the beginning, first you should understand the basics, then after how to work with Event structure.
One possible solution:
08-16-2016 11:35 AM
Without comment on coding practices, to just change what you have so it works...
First, you need to put the stop inside the loop, otherwise the inside of the loop only sees the value originally passed in.
Also, you need to edit the event so it doesn't lock the panel.
08-16-2016 12:23 PM
@Mancho00 wrote:Without comment on coding practices, to just change what you have so it works...
First, you need to put the stop inside the loop, otherwise the inside of the loop only sees the value originally passed in.
Also, you need to edit the event so it doesn't lock the panel.
I do not think it is good to teach bad programming practices. Yes, this works, but an Event structure without a While loop around it is just silly. Also, changing the panel lock behaviour can be problematic in certain cases.
I really suggest the OP to take the official tutorials and teaching material to see proper programming style...
08-16-2016 12:58 PM
08-16-2016 01:08 PM - edited 08-16-2016 01:10 PM
You don't need any event structure. Don't overcomplicate things!
(initialize the shift register if desired.)
08-16-2016 02:30 PM
Thanks everyone for your suggestion and help. Background for me is that I have been taking the NI Core tutorials. Just a starting out programmer so not too familiar with coding styles just yet. Not Labview savvy as everyone but I have to start somewhere. Thanks again for the help.
08-17-2016 12:15 AM
@brianmnguyen wrote:Thanks everyone for your suggestion and help. Background for me is that I have been taking the NI Core tutorials. Just a starting out programmer so not too familiar with coding styles just yet. Not Labview savvy as everyone but I have to start somewhere. Thanks again for the help.
https://www.ieee.li/pdf/viewgraphs/significance_of_labview_development_style.pdf