03-14-2017 08:31 AM
Hello,
i am using a Vi to read the Resistance of an Ohmmeter. This works fine, also i can let it run continously, to get the values.
However, now I want to use this VI in another one. For this purpose, i use a while loop, and place the beforementioned VI inside, connect it to a numeric indicator. When i start, the first vale is shown in the indictor, but no new values are sent to it...?
I have no idea why or whats going on.
Thank you for our help,
Markus
Solved! Go to Solution.
03-14-2017 08:39 AM
You don't understand data flow.
Your calling VI calls the subVI and waits for it to finish. You have a while loop running continuously so it doesn't finish. As a result, the calling VI is stuck waiting.
03-14-2017 08:40 AM
03-14-2017 08:51 AM - edited 03-14-2017 08:54 AM
Thanks for your answers.
But i dont see whats wrong. When i run the Vi which i call by itself, everything works fine - no error, no infinite while loop, all good...
So i Call the Vi Read Omega, i get the first value. Then in the second run everything stops working.
Why? The ReadOmega Vi works fine when i just let it run continously by itself - so i guess it does finish?
03-14-2017 09:01 AM - edited 03-14-2017 09:04 AM
I just tested gain the step by step run - There is no loop and the VI does finish! I just that only the first value gets send to the indicator? The i can go on further step by step but the value is not updated anymore?
I also added an indicator to the loop variable i - and it does increase! No waiting for the Vi to finish, but why is the new value not passed to the indicator?
03-14-2017 09:15 AM
Presumably the Read Omega vi is returning the same value over and over, but without being able to see what's happening inside of it there's no way for us to know. Can you post the whole project?
03-14-2017 09:34 AM
03-14-2017 09:44 AM
Even if it doesnt work, the first loop is cancelled when i>10, the second loop stop if a \n is read (the std. output after each send). So no infinite loop. Anyway that is not the problem as said above. But what could be the problem here?
03-14-2017 09:49 AM
Have you tried to debug your Vi will it is running?
What is the string that is return from the instrument?
(And why are you not using VISA in the correct way? Use the termination character option on the VISA)
03-14-2017 09:54 AM
@MarkusSt85 wrote:
the second loop stop if a \n is read (the std. output after each send). So no infinite loop.
And what if you are not getting any data? Oh, you will have an infinite loop! Anyways, your two loops there could be done with just two VISA Reads with the Termination Character enabled (default when using the VISA Configure Serial Port). You just tell the VISA Read to read more bytes than you expect in a message and it will do the rest. Furthermore, you will get a timeout error if data is not coming in.