Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

External Sample Clock with 2 sources

Hello,

 

I have the following HW and SW:

PCIe-6351

Rotary encoder - Signal A connected to PFI6 and Signal B connected to PFI5

Torque sensor

Labview 2015

DAQmx 17.0

 

My Problem:

I want to use an extenal signal for sampling my Torque measurement on a0. The sampling rate must be given by the A and B signals when going high.

So, every time either Signal "A" OR "B" goes high, then a measurement should be made.

The problem ist that I am not able to use 2 different sources for my sample clock.

Is there any way of doing this? Another question is: Is it possible to Sample by both rising and falling edges?

Encoder.JPG

 

 

 

0 Kudos
Message 1 of 2
(2,317 Views)

Various thoughts for you:

 

1. Sampling on all edges of a quadrature encoder isn't always the home run you might expect it to be.  With many encoders, the pulse widths of A & B individually as well as the phase relationship between A & B are spec'ed less tightly than full periods of one channel.  You get more samples, but because they may not be spaced equidistantly, you may get a repeating pattern of deviation in your analog sampling.  It will show up at 1x the rate of the A channel alone which would be 1/4 of your sample rate.

 

2. First make sure you really *need* to sample at this higher rate in order to resolve dynamics in your analog signal.  Then do some work to characterize and understand how much extra jitter you'll get by using all 4 encoder edges.  You may find that you need a better encoder to get you where you're trying to go.

 

3. A basic how-to outline:

- wire the encoder channels into digital port 0, let's say lines 0 and 1 for channels A & B.

- configure a continuous digital input task that uses Change Detection as the sampling mode.  Specify both lines for both rising and falling edges.  I'd also set a property to allow overwrite b/c I'd just as soon never have to read data from this task. 

- configure your AI task to use the special internal signal "Change Detect Event" as the sample clock.  Personally, I'd work off the trailing edge which I think is falling edge polarity.

- you can optionally configure an encoder task to use this same "Change Detect Event" as the sample clock.   You'd need the encoder to *also* be wired to the PFI pins you specify.

- Be sure to start the AI (and encoder) task(s) before starting the DI task.

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 2
(2,302 Views)