Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay for stepper motor repositioning between DAQ measmnts

I am trying to take an analog measurement at one stepper motor position(Case Structure 1); then command the stepper motor to go to a second position (CS 2); then take another analog measurement (Case Structure 3); then command the stepper motor to go to the next position (CS 4) to take another measurement etc. I am taking analog measurement at a total of 5 positions then returning to the initial position. The stepper motor is commanded using the "Basic Serial Write and Read.vi" (BSWR.vi). I am using LabView 8 and a DAQ M6259 multi-function board. I am having difficulty with setting up the delay for the stepper motor to get to the next position before taking an another analog measurement. I am using the DAQ Assistant to set up the analog board in Case Structure 1; then in Case Structure 2, I command the SM to reposition using BSWR.vi and use the Elapsed Time.vi to trigger going to the next case structure where I want to take the next set of analog measurements. Can anyone help? 
0 Kudos
Message 1 of 5
(3,964 Views)

I would venture that if you've got a stepper controller that operates via serial link, there should be a serial command you can send to query the motor's "in motion" status.  Instead of waiting for some sort of fixed elapsed time, you should query the status in a loop until it reports back that your prior move is complete.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(3,960 Views)
Thanks Kevin for the prompt reply. The stepper motor controller sends a "string response" at the completion of motion, without additional command communication. Does LabView have a method of triggering off this string response? 
0 Kudos
Message 3 of 5
(3,952 Views)
Hello GeeWhiz,

LabVIEW does not have a method that waits for a specific string response to occur on a serial port.  This is something that you would program.  You could use a while loop with a wait and serial port read inside it.  The loop would continue to execute until a certain string is read in from the serial port.  The wait is inside the while loop to stop it from taking too much processor time.  Once you receive this string on the serial port you would stop the while loop and start your data acquisition.  Please note this is just the basic idea.  You will need some extra code inside the while loop (perhaps a bytes at port property or a shift register).

Regards,

Jesse O.
Applications Engineering
National Instruments
Jesse O. | National Instruments R&D
0 Kudos
Message 4 of 5
(3,927 Views)
Thanks Jesse; I'll give this method a try.
0 Kudos
Message 5 of 5
(3,915 Views)