Hello, I have written a labview code to drvie my stepper motor (using GPIB function). This code is supposed to move the stepper motors and keep updating the current position of motors. I am having an unique problem. This code runs fine for trial no.1st, 3rd, 5th and so on. While it fails to update for trial no 2nd , 4th, 6th and so on.
The main code is "motion_update_Final_Newport.vi". It will work for labview 7 as well as 7.1.
You may not be able to run this code. However, you may be able to understand my error easily as I have figured out where is the error. The update is based on a function, which returns (string) 0 for motion not done and 1 for motion done. This value is diaplayed in "output 1" and works fine. However, "check 2" which is an indicator does not work for trial no 2nd , 4th, 6th and so on. If you go where I have "output 1", there is a while loop and "check 2" is an indicator for check. It remains on for trial no 2nd , 4th, 6th and so on.
I am attaching the code and this is for ESP 300 motion controller Newport co. I am certain that some of you would be able to figure out the error without running the code.
Steps that I am trying to accomplish: (i) I am moving the stepper motors for a relative distance. (ii) Then I am trying to get the motor position after delay (ms) [defined in front panel].
Now, how I am trying to accomplish:
First outer stacked sequence: seq 0 of outer: This sets GPIB as controller in command (without this I was having trouble when I was combining this with photodiode code). Please avoid this seq.
seq 1 of outer: The motor moves to certain relative distance. (I do not think that there is anything wrong here).
seq 2 of sequence: This part does updates the motor coordinate after delay (ms). Inside this, there is a case structure to choose whether I want the update. If I want the update, then following steps take place inside the case structure:
Inner stacked sequence:
seq 0 of inner: [This is where I think that error is taking place] Inside this, There is a while loop which terminates when the "Motion Done?" function returns "1", else "0". Inside the flat sequence structure, first sequence "updates" the motor coordinate while second check whether the motion is done . Seq 1 of inner: Controller wait till motor stops. seq 2 of inner: The motor coordnate is updated for the last time.
The update is based on a function "Motion Done?", which returns (string) 0 for motion not done and 1 for motion done. This value is diaplayed in "output 1" and works fine. However, "check 2" which is an indicator does not work for trial no 2nd , 4th, 6th and so on.
But "check 2" works fine in case of 1st, 3rd, 5th..
This seems quite strange to me.
Has it something to do with "integer/ float" issue?
Here's a few subVIs from one of my Newport libraries help you get started. I'd scrap what you have and start over; avoid the unnecessary use of sequences! You might want to sketch a state diagram before you start writing the code.
The application I use these VIs with uses a Newport RV120 rotational stage. The "RV120CCHL - INIT.vi" is used first in my application for obvious reasons. For a Move and Check of position, look at "ESP300 - Move ABS w Delay-Check.vi".
There are several other VIs included that are subVIs of these two top-level examples.
I removed undesired stacked sequence and my code is working now. I am attaching the modified version of "Motion_Update_Final_Newport.vi" just incase someone needs the code. Anyway, Newport tech support is not so great...