07-16-2018 08:21 AM
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.
07-16-2018 08:34 AM
Try to use state machine architechture.
07-16-2018 08:55 AM
@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":
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! 🙂
07-16-2018 09:28 AM
@billko wrote:
What I hear you saying is "I want to":
- Initialize the motor to its home position.
- Initialize the power meter.
- Move the stepper motor.
- Take data.
- Decision:
- IF not max range, THEN step 3
- ELSE step 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.
07-16-2018 09:51 AM
@crossrulz wrote:
@billko wrote:
What I hear you saying is "I want to":
- Initialize the motor to its home position.
- Initialize the power meter.
- Move the stepper motor.
- Take data.
- Decision:
- IF not max range, THEN step 3
- ELSE step 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.
07-17-2018 02:00 AM
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.