11-13-2019 08:58 AM
Hi everyone!
In my application I have a while loop, where Labview is waiting for the message from server. If there is an error, the while loop starts from the beginning. I want application work in this way but when the listener is waiting more than 20 seconds or the errors appear in this 20 seconds every iteration, then I want to stop the while loop and the application runs on to the next frame.
Do you have maybe some ideas how to solve this problem ? I tried with elapsed time but I'm doing something wrong maybe, because it doesn't work.
I attach a part of my code.
Thanks in advance!
11-13-2019 09:30 AM
You are going to have to use a more advance architecture. Take a look at the state machine. There are examples that ship with LabVIEW. It is hard to help you with a picture. If you post your code yu may find some that can help you structure your code a little better.
11-13-2019 09:38 AM - edited 11-13-2019 09:41 AM
One long flat sequence is not a proper program architecture!
(Not only that, but I am betting that Flat Sequence structure is superfluous anyway)
Learn how to program a State Machine.
Also don't post pictures of code, post actual code if you want someone to fix it.
11-13-2019 11:28 AM
@anna172 wrote:
I attach a part of my code.
There is the "elapsed time" express VI, but as others have already said, your problems are deeper and you should really do a few more tutorials. much of your "visible" code makes no sense.
Maybe if we could see the entire code, we could give more targeted advice.
11-14-2019 01:29 AM
I forgot to write, that I'm a new user and it's my first "bigger" application in Labview. I was learning during writing this code and I know, that much could be better or entirely differently done, but unfortunately I can't do it better yet.
Thank you for your suggestions. You're right that this "bottom error wire" is redundant. I'll try to make some changes and then if the problem won't disappea, I will attach the entire code. I haven't done it earlier because without driver S7-1200, code doesn't work.
11-14-2019 06:14 AM
@anna172 wrote:
I forgot to write, that I'm a new user and it's my first "bigger" application in Labview. I was learning during writing this code and I know, that much could be better or entirely differently done, but unfortunately I can't do it better yet.
As I see it, you'll have to do better to get the results you're after.
You can try to advance your application using the (lack of) methology you're using now. It will in fact be much harder to get working. It will get increasingly harder as you keep adding to the code.
Trust us: get into more advanced programming techniques. It is the easy way.
If programming was easy, everybody would do it.