LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI PCI 6259 with a quadrature encoder

I am using a SMAC actuator with a quadrature encoder. I am wondering the best way to get instantaneous feedback for the encoder. I have a PCI 6259 card that i am already using for other inputs but I am not sure how reliable this will be. Is there a third party encoder card that would be better?. Any help is greatly appreciated.
 
Thanks
Mike
0 Kudos
Message 1 of 6
(3,555 Views)

Mike,

Your 6259 should be just fine if you're not already using both of its on-board counters.  I've been very satisfied with the quadrature interface on both the M-series and the 660x series boards.

The default pinouts can be found in the M-series help.  I *think* that the M-series allows you to use non-defaults also (unlike the 660x), but am not 100% sure.   Note that A and B are the normal quadrature channels while Z is meant for the index pulse channel -- if your device produces one and you want to use it.

Try starting with the DAQmx examples for encoders to see how to configure and read instantaneous position.  Then post back if you get stuck...

-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 6
(3,547 Views)

OK, with that being said would i just wire  to the counter straight from the encoder. I plan on controlling the actuator based on this position measurement, will it update fast enough?. This is my first time working with NI hardware and just want to be sure that i have everything covered. Thanks for your reply

0 Kudos
Message 3 of 6
(3,545 Views)
Wiring straight from the encoder does work with some (many) encoders, but not all.  You'll need to check the encoder spec sheets and recommended interface.    You may need a "line receiver" chip or a pull-up resistor between your encoder and the M-series board.
 
There are several aspects to the "update speed."  First, the actual hardware will track the position instantaneously with each encoder edge.  Second, your program will need to make a software call that uses the DAQmx driver to retrieve that position from the board.  This is very fast and is unlikely to be problem.  A few years back I benchmarked an RT system using the older traditional NI-DAQ driver and recall a time well under 10 microseconds for a call to Counter Read.vi
 
Third, you mention controlling an actuator based on this feedback.  This opens a potentially very big can of worms.  If you're using Windows, you simply cannot get deterministic timing from your control loop.  You can sometimes get by with control loop rates on the order of 10 Hz or less, but much higher than that and you're almost guaranteed to encounter difficulties.  The problem isn't the execution time of the call to retrieve the position data.  The problem is when Windows decides to make it.
 
Finally, your control is likely to work better if you use multiple position samples for calculating your velocity and acceleration.  This would lead you toward a hw-timed buffered acquisition of encoder position.
 
What kind of control do you need to accomplish?  How does the actuator work, i.e., how do you set its speed and/or position?
 
-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 6
(3,536 Views)

I am trying to use a quadrature encoder with NI-6259 DAQmx card.

 

Quad outputs   NI-6259 inputs

     A---------------> SRC of CTR0

     B---------------> AUX of CTR0

     I ----------------> GATE of CTR0

 

I have trouble figuring out what to use as the sampling clock, I am using DAQmx\Configure\timing.llb\DAQmx Timing(Sample Clock).vi

 

Any suggestions?

 

Thanks,

Roxanne

0 Kudos
Message 5 of 6
(2,944 Views)

I'd generate a "dummy" task and then borrow its sampling clock to use on the encoder task.  Options:

 

1. Generate continuous pulse train with other counter.  Set encoder task to use 'CtrNInternalOutput' as the sample clock signal. 

2. Create either finite or continuous AI or AO task. Set encoder task to use 'AISampleClock' or 'AOSampleClock'.  If AI and continuous, configure it to overwrite unread samples.  If AO, write an array of 0.0V to the buffer before starting.

 

-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 6 of 6
(2,939 Views)