LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking to combine features of two programs into one

Hi all, this is going to be a very open question, mainly due to my zero experience with labView. 

 

I'm looking to combine elements of two example programs into one. I'm a Physics Masters student and I'm looking for a faster way to measure the beam profile (intensity in a straight line across the beam) of a laser. So I have purchased a Stepper Motor, and a Power Meter both of which have some example software meant for labView. Software for the Motor and the Power Meter.

 

I know this is a huge question, but does anyone have any tips on how to attack this? I understand the UI of both examples, but I have no idea how to combine them into my own program.

 

I'm aiming to write a program that is able to move the motor to a zero position, then move it a user-specified stepsize, initialize the power meter and take one measurement, take another step, read the power and so fourth until the motor maxes out. After which every measurement should be extractable as a file containing position, power and error on the power.

 

I hope this made sense. Thanks in advance.

0 Kudos
Message 1 of 6
(2,420 Views)

Try to use state machine architechture. 


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 6
(2,416 Views)

@PowerMeterKenneth wrote:

Hi all, this is going to be a very open question, mainly due to my zero experience with labView. 

 

I'm looking to combine elements of two example programs into one. I'm a Physics Masters student and I'm looking for a faster way to measure the beam profile (intensity in a straight line across the beam) of a laser. So I have purchased a Stepper Motor, and a Power Meter both of which have some example software meant for labView. Software for the Motor and the Power Meter.

 

I know this is a huge question, but does anyone have any tips on how to attack this? I understand the UI of both examples, but I have no idea how to combine them into my own program.

 

I'm aiming to write a program that is able to move the motor to a zero position, then move it a user-specified stepsize, initialize the power meter and take one measurement, take another step, read the power and so fourth until the motor maxes out. After which every measurement should be extractable as a file containing position, power and error on the power.

 

I hope this made sense. Thanks in advance.


What I hear you saying is "I want to":

  1. Initialize the motor to its home position.
  2. Initialize the power meter.
  3. Move the stepper motor.
  4. Take data.
  5. Decision:
    1. IF not max range, THEN step 3
    2. ELSE step 6.
  6. Save the data somewhere.

A state machine is the way to go, as mentioned above.  I listed your steps to show you how each step corresponds to a different state in your state machine (except that steps 1 and 2 can probably be combined and step 4 can be combined with step 5).

 

So read up on state machines - lots of good training advice on the main LabVIEW forum page - then try to take what you've learned from the examples and place it in the state machine.

 

We're standing by because we like helping people.  Don't hesitate to ask questions, but be prepared to be asked for the code that you've tried so far so we can make suggestions!  🙂

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.
Message 3 of 6
(2,399 Views)

@billko wrote:

What I hear you saying is "I want to":

  1. Initialize the motor to its home position.
  2. Initialize the power meter.
  3. Move the stepper motor.
  4. Take data.
  5. Decision:
    1. IF not max range, THEN step 3
    2. ELSE step 6.
  6. Save the data somewhere.

Let me offer up a slight variation that I think will help things.

1. Initialize motor and move to "home"

2. Initialize Power Meter

3. Create log file and write header line(s) (keep reference in a shift register)

4. Move motor

5. Take measurement and save to log file

6. If not(max range), go to 4

7. Close log file

8. Close Power Meter

9. Move motor back to "home" and close

 

The biggest change I put in there is to log the data as you go along.  This saves memory and gives you a chance to keep some data even if something really bad happens.

 

But, yes, you definitely need to use a State Machine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(2,381 Views)

@crossrulz wrote:

@billko wrote:

What I hear you saying is "I want to":

  1. Initialize the motor to its home position.
  2. Initialize the power meter.
  3. Move the stepper motor.
  4. Take data.
  5. Decision:
    1. IF not max range, THEN step 3
    2. ELSE step 6.
  6. Save the data somewhere.

Let me offer up a slight variation that I think will help things.

1. Initialize motor and move to "home"

2. Initialize Power Meter

3. Create log file and write header line(s) (keep reference in a shift register)

4. Move motor

5. Take measurement and save to log file

6. If not(max range), go to 4

7. Close log file

8. Close Power Meter

9. Move motor back to "home" and close

 

The biggest change I put in there is to log the data as you go along.  This saves memory and gives you a chance to keep some data even if something really bad happens.

 

But, yes, you definitely need to use a State Machine.


Thanks for refining the steps.  It makes more sense to do it this way.

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.
Message 5 of 6
(2,372 Views)

Hey Kenneth,

 

As you wrote you are a student with zero experience in LabVIEW, there might be some learning resources available for you: Your university could have access to the Self-Paced Online Training (SPOT) from National Instruments. If so, this explains how you can get access: Accessing Online Training on an NI Academic Site License.

 

Have a look as "LabVIEW Core 1", this course has all the basics, including the State Machine that Bill and crossrulz mentioned.

 

 


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 6 of 6
(2,348 Views)