07-24-2018 07:59 AM
Hi,
Q1 programming environment of CLAD Preparation Guide LabVIEW 2017. Event structure inside while loop to count the number of times the increment button is pushed. I think that both B and C meet the specs. I attach image of both options.
Why answer C meets better than B?
Thank You!
Solved! Go to Solution.
07-24-2018 08:40 AM
Hi,
What is the exact exam question ?
My guess is that it all depends on the mechanical action of the button.
C works better because whatever the action is, the counter will increment any time you press the button.
B would not work to count every click on the button in the case the button goes from TRUE to FALSE. In that case, the control is read as FALSE and nothing is incremented.
Hope it is clear 🙂
07-24-2018 09:53 AM
Just for fun, let's go through all of the options.
A - Using the timeout case, which stops the loop. So that is obviously wrong.
D - The numeric is an indicator, so that case will never be fired. Plus the requirement was for the button to be pressed. So, again, obviously wrong.
Now we come to B vs C. Button implied the mechanical action is "Latch When Released". Therefore, B and C would work. But C is simpler and therefore better.
Thinking about this way too much now...Even if the button was set to "Switch When Pressed", we still want the increment to happen every time the button is pressed, as stated in the requirements. B would only increment when the value of the button changed to TRUE instead of all presses. So B is therefore wrong.
07-25-2018 02:38 AM - edited 07-25-2018 02:54 AM
Hi,
If C is simpler is one reason to be better. But I think the question could be a little bit more specific with the mechanical action used for the increment button.
Option C does not work with switch until released and latch until released because each time is pressed the increment is 2 times
Option B does not work with switch when pressed and switch when released because only increments from false to true. Also it does not work when latch until released because each time is pressed the increment is 2 times
Then B works for 50% of possible mechanical actions and C for 66,7%
07-25-2018 06:24 AM
@jesLVbcn wrote: But I think the question could be a little bit more specific with the mechanical action used for the increment button.
I agree. But for the sake of this test, let's look at what is actually used. I would say 99.9% of my buttons use the Latch When Released and 100% of my switches use Switch When Pressed. These are the defaults and I very rarely deviate from those, mostly from lack of need to. So for the sake of this exam, it is safe to assume button is Latch When Released and switch is Switch When Pressed.