08-13-2019 03:33 PM
Vision builder stop responding/hangs after calling a "vi" that contains a while loop and a event structure inside. The event structure has a timeout of 130ms and an event handler of "Value change" which is connected from an string control, what i'm trying to do is to prevent that the user can introduce a password with the keyboard. He can only scan the password via a usb scanner. The VI runs properly if I run it inside the Labview environment, but when I try to call it from Vision Builder, it hangs and does not respond to anything. Some advise to solve this issue?. Thanks in advance!
Solved! Go to Solution.
08-16-2019 10:16 AM
Is it possible to share the code here?
Also, does the front panel of the VI come up when you run it from Vision Builder?
I bet that it has something to do with that event structure, either not timing out and potentially not being supported being called from the Vision Builder environment.
08-16-2019 12:18 PM
Hi, cweeks12,
in fact, i found the code here in the forum:
What i'm trying to do is that the user can only introduce the password using the scanner and not the keyboard.
By the way, I'm new in VIsion Builder, and have some little experience with Labview..
Thanks.
Jose M.
08-19-2019 11:28 AM
I would be interested to see if any errors come up when running it from VBAI. Can you display the error if there is one coming off of the property node, potentially with a Simple Error Handler VI?
Also, do you see the front panel when this step runs? Or does it not appear?
08-19-2019 12:44 PM
The way Vision Builder AI runs VIs expects the VI always return, so instead of putting your code in a while loop, I made a sample VI to illustrate how you might accomplish the same thing in VBAI by using the transitions of VBAI state diagram to loop on the VI instead of a While Loop inside the VI. I would also recommend you use the User Input step in VBAI for this type of application, so I included a sample of how to do this in the inspection as well. Just press the Run Once button in VBAI at the top after loading the attached inspection and notice it doesn't let you continue with inspection states until you enter a valid password. You can obviously change this behavior, but I thought this would illustrate something useful for you.
Hope this helps,
Brad
08-19-2019 03:40 PM
I attached a video showing the behavior of VBAI when I try ti run the VI that contains the while loop. As you can see, when I press the Test button VBAI stop responding, even I cannot see the textbox to introduce the password, I mean I cannot see the front panel, see the image of the front panel below.
Please see the video below:
08-19-2019 03:51 PM
Hi, Brad,
Thanks very much for your suggestion and for your sample.
I will try it later, so now I'm a little busy and let you know the results, but I think it is going to work for what I need. Thanks again.
Jose
08-19-2019 03:53 PM
As I mentioned in my previous post, you shouldn't have VBAI call a VI that doesn't return. Try my example and see if that helps. If you really wanted your example to work, you'd need to add an invoke node to show the front panel when the VI is called (see my example VI attached in the previous post for how to accomplish this). I think you will want to use the User Input step in VBAI though as my previous post illustrates.
Hope this helps,
Brad
08-20-2019 12:23 PM
Hi, Brad,
Your sample is working well, also the User Input step works fine. But what I want to accomplish is that the user cannot use the keyboard to introduce the password, instead he should use an usb scanner. Do not know if I explain well what I'm trying to do. Now I understand what you said about that calling a VI from VBAI that contains the While Loop.
Thanks and regards,
Joemen.
08-20-2019 01:27 PM
Just replace my example's simple string control with VIs to read a string from a scanner so you can compare that string against expected values. Just make sure you aren't calling it in a loop that may never end.