Showing results for 
Search instead for 
Did you mean: 

SubVi and WhileLoop

Go to solution

I have tried to go step by step - but there i dont see a mistake. What do u mean with debugging while running?


The String looks like this:
I am reading untill the (second) \n character is send - whats would be the correct way?

0 Kudos
Message 11 of 21

Aa i tried it doesnt work - i used the read command with, lets say a byte count of 1000, but it doesnt stop after \n.

It continous reading, dont ask me why


And again there is no infinite loop! When i call the Read-VI in a while loop, the loop continues. I checked the iteration of the loop and it does increase, the value however is not updated!

0 Kudos
Message 12 of 21

@MarkusSt85 wrote:

Aa i tried it doesnt work - i used the read command with, lets say a byte count of 1000, but it doesnt stop after \n.

It continous reading, dont ask me why

Sounds like because you did not enable the Termination Character.  If you posted your initialization code, we could figure that out and make life easier on you.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 13 of 21

There is no initialization code. The only VI i havent send yet is the send VI


0 Kudos
Message 14 of 21
Accepted by topic author MarkusSt85

Debug your code with Highlight execution and probes. 

You should be able to debug the sub vi and see what values are returned. 


How do you know that the code is not working correctly ? 


Message 15 of 21

You need to setup your COM port correct BEFORE you start reading and writing to it. 

And you need to close the COM port when you are done with it, like when your main vi is stopping.

0 Kudos
Message 16 of 21

Well i mean it does sth 😉

I did now the debugging with Highlight execution, there is one thing:


Is it possible that the feedback node keeps the value, and so send it again instead of reading bthe new values?

How can i clear the feedback node after the VI or loop is finished?


That would also explain, why it works when i let the VI run contiously, but not when i call it from another VI in a while loop?!

0 Kudos
Message 17 of 21

There is no need to initialize anything here (i mean regarding the device). And im using the USB port.



0 Kudos
Message 18 of 21

Yep that was the Error!

Moving the initializer one loop out solved the problem, not the feedback node gets reset each time the loop is finished!

Thanks everyone.


Any suggestion regarding a better way to program this? I started to work with labview 5 days ago 😉

0 Kudos
Message 19 of 21

Why are you sending partial screenshots instead of the actual code?


That said, you still haven't defined the behavior you're seeing.


In the caller VI, attach an indicator to the  iteration terminal (the blue i) and run your code.  Does the value increase while you're running?


Have you used highlight execution in the subvi to see what you output?


For a third time, can you attach your code so we can play around with it and see what you're doing rather than try to recreate it to help you?

0 Kudos
Message 20 of 21