Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling steppers, reading encoders, and reading analog sensors at the same time

Hello all,

 

I'm working on a fixture that will measure the thickness of a part using two laser sensors (analog (current)) that are mounted on two linear slides controlled by two steppers* (analog (voltage)), and two encoders (counters).

 

*Note: the steppers have a control board that allows an analog input for speed (0-10V).  I'm not using the STEP, DIR, or EN pins

 

I'm using an NI USB-6218 DAQ.  It has two AO's, two counters, and plenty of AI's.  I'm also using Labview 2017 to program everything.

 

What I want to do, is control the fixture using this DAQ.  What I'm, quickly, finding out is, timing is very important, and very picky.  I'm coming across multiple errors where some tasks can't be read fast enough, etc.

 

Currently, I have 4 tasks:

Encoder 1

Encoder 2

Analog Inputs (for laser sensors)

Analog Outputs (for steppers)

 

Can anyone guide me in a direction where I can create standard VIs to control the steppers to go a certain distance (using encoders), read the laser sensor values at any point, etc.

 

Attached is what I currently have.  Any help is appreciated!

 

Thanks!

Joe

 

0 Kudos
Message 1 of 3
(2,287 Views)

It will help to give specifics on the hardware you are working with (NI hardware and others) as well as focus on some specific issues you'd like to resolve. 

What error codes are you seeing? Are they time outs? Overflows?

0 Kudos
Message 2 of 3
(2,242 Views)

Hi DahlmanR,

 

Actually, I have figured it out.  I'll try to summerize what I wanted, and what I ended up doing (for those that see this post later).

 

I have an NI USB DAQ (the USB-6218 to be exact), two stepper motors (Applied Motion Products TSM17Q-1AG), the two encoders that are built-in to those steppers, and two laser range sensors (Acuity AR700-2).  What I wanted to do, was make a Labview program, that would control the NI DAQ to control the stepper motors and read from the encoders and laser sensors.

 

What I had problems with, was I was getting overflow errors (the application wasn't keeping up with the data acquisition, etc.)  What I found out was, I was taking continuous samples of the various inputs/outputs.  What I did, instead, was take 1 sample, and put that "Read" or "Write" block in a While loop.  That seemed to solve the overflow issues.

 

I'm still working on the project, but everything is running much smoother now.

0 Kudos
Message 3 of 3
(2,229 Views)