Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

3-Channel angular position measurement

Hi,

 

I have the PXI-6230 available in my PXI system. What I am trying to achieve is to read the outputs of a stepper motor driver and determine the corresponding angular position and direction (i.e.. like a stepper motor simulator). The driver outputs 3 pulse trains (3 coils). I am wondering if it is possible to use the counters on the PXI-6230 for this application? I've read some info on the M-Series Counter X1/X2/X4 Encoding for position measurements. But such methods require only 2 input channels A & B to detect the pulse counts and direction. Is there a workaround to apply this encoding method for my application? Any help/advise is greatly appreciated...

 

0 Kudos
Message 1 of 4
(6,055 Views)

There's probably a way to kinda sorta "cheat" your way into a pretty decent measurement.  Let's review standard

quadrature states:

 

A  B

-------

F  F

T  F

T  T

F  T

F  F  (repeating...)

 

If your state transitions move down the table, you'll get positive position increments.  If they move up the table,

you'll get negative increments.

 

Now let's consider the state table for a 3 phase stepper:

 

A  B  C

-----------

F  F  F

T  F  F

T  T  F

T  T  T

F  T  T

F  F  T

F  F  F  (repeating...)

 

Now if you consider just phases A&B, you'll see that over the course of a 6-state cycle, you'll produce the

same 4 transitions found in the original quadrature table.  Two of the states produce no transitions on either

A or B.   So, you can't really measure each and every step taken by the 3 phase stepper.  But if you "lie"

to your encoder config and claim that the size of each step is 1.5 times as big as a real step, then at least

on average you'll be tracking cumulative position pretty well.

 

-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 4
(6,040 Views)

 

Many thanks for your quick response and suggestion for a possible solution Kevin.

One further question Kevin, does the M-Series PXI card has a built-in software function to retrieve the direction of movement based on the inputs A & B? Thanks again for your kind support.

 

/Harvey

 

0 Kudos
Message 3 of 4
(6,029 Views)

Dunno if there are new ways in newer DAQmx versions since I'm not near a machine I can double-check.  Meanwhile,

I'll describe a way I've often handled it:

 

1. First of all, the M-series counters have true quadrature decoding built into the board so that direction is handled properly.  When you move one direction the count increments and when you move the other, the count decrements.

 

2. I don't know of a method to "retrieve" the direction itself with a software query.  You might need to remember (think "shift register") the previously queried position so you can figure out direction yourself after retrieving the current position.

 

3. Most of the time I read my counter values as u32 datatypes rather than as scaled floating point values.  Kind of an old-school habit since I "grew up" under the older "traditional NI-DAQ" driver.  However there's one little gotcha to look out for.

   Since most tasks start with default count value of 0, it's very common for quadrature motion measurements to decrement below 0.  However, u32's cannot express negative numbers so the count will suddenly jump from 0 to 4 trillion something (specifically, 2^32 - 1).  If you pass any u32 readings through an i32 data conversion function (numeric-->conversion palette), the bits get reinterpreted in the expected way so that a decrement from 0 reads as -1.

 

-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 4 of 4
(6,017 Views)