From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start to program with a LabView project

Solved!
Go to solution

Hi, 

I am a new comer to LabVIEW program. I have finished the basic training of LabVIEW Core 1, 2 online but still have problems when I start to program in LabVIEW. I am having a project now to use LabVIEW to control the laser diode system, drive a translation stage with power meter to measure the power at different positions, while triggering the camera to take images, triggering the spectrometer to measure the spectrum and then save all the data and move to the next position. This procedure goes on until the end position and then turn off the laser system and return back to the home position. 

 

The problem is I am having difficulty to organize my thoughts on deciding which structure is most efficient to put different functional VI together (like whether to use while loop, case structure or sequence structure or combination of them). I would like to ask for the general suggestions on how to design and start programming in the LabVIEW. Should I search and follow the existing LabVIEW examples as the starting point or should I just start to design without any reference. Thanks!  

0 Kudos
Message 1 of 4
(1,977 Views)
Solution
Accepted by topic author gongchao8295

Hi gongchao,

 

as you describe several states of your algorithm you should try to use a statemachine.

 

LabVIEW comes with ready-to-use example projects, one of them being a basic statemachine implementation!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(1,952 Views)
Solution
Accepted by topic author gongchao8295

@gongchao8295 wrote:

Hi, 

I am a new comer to LabVIEW program. I have finished the basic training of LabVIEW Core 1, 2 online but still have problems when I start to program in LabVIEW. I am having a project now to use LabVIEW to control the laser diode system, drive a translation stage with power meter to measure the power at different positions, while triggering the camera to take images, triggering the spectrometer to measure the spectrum and then save all the data and move to the next position. This procedure goes on until the end position and then turn off the laser system and return back to the home position. 

 

The problem is I am having difficulty to organize my thoughts on deciding which structure is most efficient to put different functional VI together (like whether to use while loop, case structure or sequence structure or combination of them). I would like to ask for the general suggestions on how to design and start programming in the LabVIEW. Should I search and follow the existing LabVIEW examples as the starting point or should I just start to design without any reference. Thanks!  


Think about what you are doing.  You're doing a bunch of stuff over and over in the same order before finally quitting.  To me, this seems like a good fit for a state machine.  It's up to you how you want to break it down, but usually, each "thing" you want to do is a state.

 

If you plan to have some user intervention - even if it's just an abort button - then think about the Queued Message Handler (QMH) design pattern.

 

This might be the hardest part for a beginner because it takes experience - either through trial and error or through benefiting from someone else's, as you are doing here - to make the "right" choice.

 

And "right" is in enclosed in quotation marks because, sometimes, the solution that is right for someone else may not be right for you.  This is because everyone eventually develops their own "style" where they might prefer a different design pattern to satisfy a set of requirements than someone else.

 

So dive in and let us know how you're doing.  Show us your successes as well as your failures so we can help to guide you.  As a beginner, it might be that some of your successes are actually failures waiting to happen.  Heck some of my successes turn out to be failures waiting to happen.  You can only hope that the more experience you have, the less likely this is to occur.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 4
(1,944 Views)

Hi Bill, 

 

Thanks so much for your reply. This is very helpful to me. 

 

Best, 

 

Chao

0 Kudos
Message 4 of 4
(1,939 Views)