01-06-2017 03:19 PM
Hi everyone,
I am having a problem with a VI where I read two analog inputs and save one of them into an Excel file. As you can see in the picture of the block diagram attached, I also enter a target value for the first signal and want to check whether the first signal exceeds this target value or not by using an LED indicator. The problem is that the LED indicator turns green once the 1st signal exceeds the targe value but when the signal falls below that level, it turns off again. However I want it to stay ON even if the signal is below the threshold. I tried so many things with 'while' and 'for' loops but couldn't solve the issue.
I would be glad if you can share your opinions about this issue.
Thanks in advance.
Solved! Go to Solution.
01-06-2017 03:22 PM
Wire your comparison into a shift register. Then make your indicator show whether the comparison OR the previous value (from the shift register) is TRUE.
01-06-2017 04:44 PM - edited 01-06-2017 04:46 PM
Please attach the actual VI instead of pictures!
A solution to your problem has nothing to do with loops, just boolean logic. If you want tie LED to stay on, you probably also want to implement a mechanism to reset it at one point.
A feedback node would be simpler than a shift register. You are also complicating things tremendously by using dynamic data throughout. You are actually comparing both values, but since you wire a scalar indicator, you only get the result of the first channel. Look at all the coercion dots! Your code is very opaque and hard to debug.
(Note that your code is very poorly designed. If you are not careful in configuring the event structure, your VI will lock up permanently if you would press the OK a second time during execution. An event structure should not be used as a "one shot" deal. Have a look at state machine architecture instead. Also, your sequence frame serves absolutely no purpose. Nothing would change if you would delete it, so why is it there?)
01-07-2017 12:01 AM
Dear altenbach, thank you very much for your response. You can find my VI attached and regarding your solutions I would really be grateful if you can refer me to specific functions, videos or tutorials rather than describing the solution in words. The reason is that I am not so familiar with Labview therefore when you say that I should implement a mechanicsm to reset a boolean logic, I really can't grasp what exactly I should be doing. Then what happens is that I would search for videos using your words as keywords and find myself watching tutorials about things that are totally irrelevant. In summary I would be really grateful if you refer me to a specific video, a tutorial and so on.
Thanks for your reply again 😉
01-07-2017 12:05 AM
Dear gregoryj, thank you for your response. I am watching tutorial videos on "shift registers" now and will be giving it a shot shortly 😉
01-07-2017 01:49 AM
This could give you some ideas...
01-07-2017 06:50 PM
Thank you very much 🙂 I have updated my VI by making use of what you shared and now it works as I want 😉