LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counting edges and synchronization in NI PXI-6143

Hi,

 

I have a PXI-1044 rack with a MXI connection. I have NI PXI-6143 cards.

I count edges from an incremental quadrature encoder (A,B,Z).

I read AI signals (voltage, current, torque), it is hence important that I can buffer the data and synchronize it with the same sample frequency as the other signals (+/- 10kHz).

Does someone have an idea how to start with it?

 

Regards,

BaWy

0 Kudos
Message 1 of 4
(2,763 Views)

Um, my best idea for starting with it might be, "Don't".

 

A super quick look at specs for that card show that it has 24-bit counters, so I suspect it uses the old DAQ-STC timing chip.  Those counters cannot directly interface with a quadrature encoder.   There were some old tricks that usually mostly worked almost correctly, back when there wasn't much alternative, but that's not really such a great end goal.

 

Now, that said, maybe you're stuck with that board and have to make the best of it.  If your motion is truly unidirectional, including no vibration when stopping, you might be ok.  If you have bidirectional motion or vibration you either need an external quadrature decoder or a data acq board whose counters support quadrature.  (I'd start by looking at the X-series if your chassis has slot support, M-series if not.)

 

The way to sync the tasks is to share the AI Sample Clock by configuring the counter task to use it as its own sample clock.  Then you need to make sure to call DAQmx Start for the counter task before you call it for the AI task.  Understand that the count register may increment to some non-zero value before the first AI Sample Clock edge comes in to sample it.  Then realize that you should retrieve data from the tasks in same-sized chunks to keep the data streams in sync.  

 

Below is a quick and *incomplete* snippet to illustrate key points.  It is *not* complete and ready to run, it just shows how to do those specific things I referred to.

 

 

-Kevin P

 

sync AI and counter.png

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 4
(2,732 Views)

Thank you for your reply. I tried what you have suggested. I write the code for the generation of digital pulse with hardware timing with the help of DaqMx Timing(Sample Clock) for only one channel. But the timing resolution is not good here also I have attached a photo of the output(Oscilloscope signal) where you can easily see the discrepancy which was I think less in the software timing Vi(the previous one). This Vi is only for one channel for more I have to share the sample clock but at the first stage itself it is showing this issue. Please have a look and give some suggestions.

Download All
0 Kudos
Message 3 of 4
(1,529 Views)

Sorry I mistakenly reply in this thread. I have copied my reply to the original thread. Please ignore here.

0 Kudos
Message 4 of 4
(1,525 Views)