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.
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.
08-21-2014 10:09 AM
Hello friends,
I have a doubt with my program. I've made a statemachine (using Lab 9.0, no possible to use a new one) to move two motors and make a measurement (IV curve). Motors move and measurement is done, however this measurement is made meanwhile motors are moving, why?
What should I do? I want the motors move, then make the measurement, when this is made, then move motors again and so on.
Any idea? All help is appreciated.
Attached you can find the program (sorry because of the drivers, they are Thorlabs for motors and Keithley 2400 for Measurement)
Solved! Go to Solution.
08-21-2014 10:15 AM
No attachment.
My initial thought is that you need to add a wait after moving the motors to allow the system to actually respond before you take the measurements. Hard to say for sure until we see some actual code.
08-22-2014 03:10 AM
You´re right Crossrulz, I forgot to attached the code, sorry!!
Here you´ve got it! I´ll wait for your answer!!
08-22-2014 03:43 AM
Hi lacorgui,
you need to wait for your motor(s) to reach it's postion. Right now you just send a command to the motor(s) but you don't wait for them to finish movement…
Setting a callback is not the same as waiting for finished movement!
08-22-2014 04:12 AM
Hi GerdW,
I added the callback as a possibility but I do not know exactly what expect from it. I understand that I have to wait for the motor to reach its position, but how could I make this?
Thanks
08-22-2014 04:14 AM
08-22-2014 04:20 AM
I see.
The thing is that if I run the program with the "light" (like in a probe mode) it works fine: first move, then measure once motor is stopped.
However, if I run the program directly measure is taken while motor is moving to next position. I will need the program to make thousand of measurements in a sample for long periods of time so I have to be sure that the motor stops and then measures.
My question is your point: how can I tell the program to wait in the state until it reaches the position?
(Thanks for your help)
08-22-2014 04:26 AM
Hi lacorgui,
you set a new position and you read the current position.
What about a simple comparison if "current postion" is (nearly) equal to "set position" and changing the state based on that comparison?
That's how a state machine works: you have some rules to decide which state to go…
08-22-2014 04:28 AM
Ok, I´ll try that.
08-22-2014 06:49 AM
lacorgui wrote: The thing is that if I run the program with the "light" (like in a probe mode) it works fine: first move, then measure once motor is stopped.
That is called Highlight Execution. Things with instruments tend to work so much better with Highlight Execution turned on purely because it slows your code down to a crawl. This just screams the need to add in waits. The state machine approach is the better way to go.