LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update stage position reading

Part of my current project involves controlling a linear stage, via stepper motor. I need to home the stage, take a reading from the DUT, then advance the stage 0.001" and take another reading. Total movement is 0.1", so I'll be moving the stage 100 times and taking 101 readings.

The problem I'm having is that at the beginning of each test the position indicator (which is inside the FOR loop) continues to show .100 while the stage homes, and until the loop iterates once. Then of course it reads correctly. I'd like to have it read correctly all the time. How can I accomplish that?

If I can piggyback another question in here, I've got a user adjustable delay in the loop, and also need a delay between the home position and the first loop iteration. Is the timing loop I inserted the best/easiest/only way to do that?

I've attached the VI for reference but I believe if you run it without the stage, it will lock up.

I am dripping wet behind the ears here so any other feedback you have on this VI will be appreciated.

Thanks.

Jon
0 Kudos
Message 1 of 5
(2,573 Views)

Hi Jon,

1- In response to your first question related to monitoring the position of your stepper motor, I would recommend using a seperate while loop to monitor the position of your motor. This would allow it to be updated on the front panel at all times throughout your process. See the attached screen shot for a visual representation of what I'm proposing.

2- Although the way you have implemented your delay will work correctly, there is a more efficient way to create the delay, through the use of a sequence structure. This requires that everything inside of the current sequence frame is finished executing before it continues. Therefore if you wire your Motor reference and error line through a sequence structure containing the delay it will halt execution until the delay is finished (see the attached screenshot). Note however that the lower while loop monitoring the position will not be halted.

Hopefully this helps to get you pointed in the right direction. Let me know if you have any further questions or clarifications.

Cheers,

Jonah
Applications Engineer
National Instruments

Jonah Paul
Marketing Manager, NI Software
0 Kudos
Message 2 of 5
(2,543 Views)
Thanks for the tip about inserting a flat sequence with wait timer. That seems to work well.

I had tried the separate While Loop before, and tried it again based on your suggestion, but I'm getting an error message which I believe is based on the motor StopCtrl that is activated after the For Loop completes. Message says, in part:

"A software call has been made to a control which is not currently communicating with any hardware."

What can I put between the conclusion of the For Loop and the StopCtrl node that will trigger the Stop terminal of the While Loop?
0 Kudos
Message 3 of 5
(2,524 Views)
Hi Jon,
 
In order to ensure that the your while loop end before you try stopping control, you could add a single sequence frame (similiar to what you did before the for loop) and place a local variable which references the stop button in the while loop. You can create a local variable by right-clicking on a control in the block diagram and select Create >> Local Variable. In the sequence frame then write a true to the stop local variable and place a delay to ensure that it has enough time to complete the while loop stop.
 
Let me know if this helps!
 
Cheers,
 
Jonah
Applications Engineer
National Instruments
Jonah Paul
Marketing Manager, NI Software
0 Kudos
Message 4 of 5
(2,509 Views)
Thanks for the suggestion! It took me a while to figure out how to do that, but I did try it. It seems to cause other problems, unfortunately. For the time being I've decided to choose "clear indicators when called" from the operation options and just let the stage position say "0" until it homes and begins moving again.
0 Kudos
Message 5 of 5
(2,463 Views)