03-03-2020 08:43 AM
I'll suggest (like RavensFan (and probably everyone else)) that subVIs are great, and you should get working on them as soon as possible.
If you're currently unfamiliar/uncomfortable with them, there's no time like the present to change that.
If you're familiar with other programming languages, a subVI is just like a function. It has inputs and outputs (connector pane) and if you don't use references it generally works in a fairly straightforward manner.
Any time you find code that you're going to repeat, or want to call at a specific time or in a specific location, a subVI is probably a good choice.
Using the probe tool (and/or additional indicators) can help with debugging possible issues. Commonly, subVIs include error in/out controls and indicators which then allow both sequencing and checking the error behaviour.
03-03-2020 08:49 AM
@Torracc wrote:
For me it is way easier if I can see the compelte code the whole time. THis, I can try to follow everything and find a possible error and its solution.
That will very quickly lead to information overload and you won't be able to follow anything. There is a reason engineering has more and more pushing for modularity: it is easier to see the overall picture when you don't have to worry about the minor details. Conversely, it also makes it easier to concentrate on exact issues because you can focus on small parts of the application instead of navigating everything.
03-03-2020 01:23 PM - edited 03-03-2020 01:24 PM
@Torracc wrote:
@crossrulz wrote:
You need to follow some previous advice and create subVIs. You definitely want a VI just for sending a command. You should also make one for each command you want to send. This will help immensely in just organizing your code. It would also be beneficial if you used a cluster for your status to even better organize it.
So for me as a beginner I find the use of SubVIs not so easy. For me it is way easier if I can see the compelte code the whole time. THis, I can try to follow everything and find a possible error and its solution. I get that the use of SubVIs is useful, but I struggle a little bit with them at the moment. Maybe later I can get used to them a little bit.
You might think that it makes easier to troubleshoot until you make a few subVIs and suddenly any errors you get are extremely localized and you no longer have to follow everything around.
SubVIs are directly analogous to functions in a text-based programming language. You wouldn't dump all your code into main(), right? Same goes for LabVIEW. You don't dump everything into one VI for all the same reasons as you wouldn't dump all your text code into main().
EDIT: Guess I'm a little late to the party. 😉
03-03-2020 01:54 PM
@billko wrote:SubVIs are directly analogous to functions in a text-based programming language. You wouldn't dump all your code into main(), right? Same goes for LabVIEW. You don't dump everything into one VI for all the same reasons as you wouldn't dump all your text code into main().
And for some reason, you just reminded me of this story: The Dense Forest.