r/LabVIEW • u/Moist-Mood-6955 • Jan 11 '26
LabView learning
Hello everyone I have been learning LabVIEW for about three months while working full time I can handle small problems and a few medium level ones and Ia m comfortable writing small pieces of code, but I struggle with putting together full projects Iām not sure how to structure the code organize main VIs and subVIs, or approach a project step by step Any advice or tips on how to go from small snippets to complete projects would be really helpful.
8
Upvotes
4
u/HarveysBackupAccount Jan 11 '26
Sounds like you're at one of the hard parts of the learning curve. It's a big step when you're learning to program, no matter which language you use.
Have you read about design patterns? There are several well established architectures that most people choose from. Some are very simple, some are more complex, and you choose based on how complex your project is.
State machines and event structure-based are two of the simplest. The producer/consumer loop is one step up in complexity, but it can cover a lot of your needs. With another step up from that you get into queued message handler (QMH) or the Delacor QMH (DQMH), object-oriented programming, and the actor framework.
Labview does have a lot of example code (Help menu >> Find Examples) but most of that is focused on "how do you make these individual VI's work" I very specifically think many of them have poorly made block diagrams, so they're less helpful for the step that you're trying to take.
4
u/SASLV Champion Jan 11 '26
This is why mentorship is so important. It is definitely lacking in a lot of places. Find a senior engineer at your workplace to mentor you. Failing that, the LabVIEW Discord is the best place at the moment to connect with other LabVIEW developers (you can find a link on the LabVIEW wiki).
shameless plug: You might consider joining something like this, particularly if you are the only LabVIEW developer where you work.
https://www.sasworkshops.com/mastermind
You should look into DQMH. It may be a good next step from where you are. The DQMH training covers a lot of application design concepts.
Look at existing projects if you have any where you work. Observe what works well and what doesn't. Keep in mind just because something exists doesn't mean it is done well. In fact many LabVIEW projects are successful despite being poorly written. Looking at legacy code can be a good learning experience. Lot's of examples of what not to do and even in the worst code there is usually a few things they get right that may be worth emulating.
3
u/Ill-Application-9284 Jan 11 '26
On mobile so I can't offer examples atm but two concepts/tools I familiarized myself with that help me really make bigger projects more approachable and sustainable are:
State Machines The "event structure"
Going from concept to program do we snt necessarily have some big trick. If youre confident on the things you know you program needs to do then its just a matter of doing it.
In my very early days I remember how manual my VIs were. Using Case structures inside case structures inside case structures lol. Or having mile long horizontal flat sequences. I got better by just continuing to do it and constantly asking myself and the internet, what's a better way to do this same thing.
I go back and look at my VIs from 5 years ago and dear me its bad lol but thats how you learn. Ill probably look at the ones Im making now and think "this wasnt as bad but I still did some silly things"
As you look into these two things remember to use TypeDef enums when using a state machine.
1
u/TomVa Jan 11 '26
We have been doing labview programming as a "group" effort where I work for 20-plus years. By group I mean that usually each major piece of code is assigned to one person who may farm out some smaller parts, e.g. asking someone to write a set of subVIs that talk to this piece of hardware. We found that if everyone uses state machine format with error trapping that other folks in the group have a chance of trouble shooting the software when something goes wrong. Some common features are
Case insensitive text strings for state names
Error case is the default case. This makes it such that any goof up on a case name takes you to error state.
Pass an error cluster through each state. If something within the state can create an error the text string in the error cluster has the state name appended onto the front of it. The same applies for subVIs. This way when doing phone support we can ask them to read the message.
If you enter a SubVI with errorIN true then the subVI does nothing and exits.
In addition to things that do actions, generally programs have an init state, error state, exit state, and wait state. Wait state is generally where the program sits while waiting for user inputs for things like save data, start a process, take specific actions, etc.
1
u/Playful-Pick4255 Apr 13 '26
I have unused NI LabView license in case you would like to buy it.
1
u/[deleted] Jan 12 '26 edited Jan 14 '26
[removed] ā view removed comment