Hello, i would like to ask you about high frequency quadrature decoder. I am using module in DAQmx for measuring linear position. For this i am using NI PCI 6221. My problem is that i want to use this for my interferometer and we need really high speed. So I tried to use External timing whitch should be possible for this card up to 80MHz. Unfortunatelly i always will get error message that there is some kind of owerflow and my program crashes. So my question is how to get all data form this card. I know that the buffer size FIFO is only 2 so if it is impossible to get all data so i want find another solution. Is it possible let my card work alone on 80MHz and only repeatly rewrite all buffer and just sometime ask this card for sending current buffer. I dont really need all the data, but when i will ask i need to know reall position. This high speed is really necessary because my interferometer is sensitive and i dont wat to lose any steps. If there would be any possibility how to work on 80MHz and only sometime ask for sending data with position, it would be great. Sometimes i will ask not for only current position but for full buffer because i want so see what is happening during some time period, but this task will be only sometime.
Quick tip: It sounds like you're under the mistaken impression that you need to set a very high sample rate to record every quadrature edge. That's not true. When you do a position measurement task on a counter, what you are sampling is the count value held in a count register, *not* the digital state of the quadrature signals.
This is an important distinction. The count value will increment or decrement with quadrature edges due to hardware circuitry on the board. It'll do this whether you are requesting samples of that count value or not.
as Kevin said, if you wish to measure position with an encoder, and you don not need the signal itself, you can use inbuilt counter functions on the card to count the digital edges of the encoder, and read the counter output at another frequency you specify. Your card has support for angular encoders, the Example Finder has a few really good use cases under Hardware Input and Output/DAQmx/Counter Input, please check out if those are working for you. If you have any other questions or errors plese get back to me.
Thank you guys for reply. I really need this function that counter will run on another frquency and i will read just sometime on other frequency. I will try to check this examples.
so i have this simple progrmam: measure_linear.vi . It is really simple so i create task with CI linear encoder and then i want to read every loop 1000 samples.
So how i can be sure that my counter (Dev1/ctr0) is working on the highest frequency (mean 80MHz which is in manual), i really need the fastest sampling as possible. And then what kind of data i will get if i will ask for 1000 samples. Are those first 1000 samples in buffer or last read 1000 samples? And if the working frequency is 80MHz and i will read only 1000 samples lets say every 10us. I get 1000 samples than i throw away 800 000 samples and again read 1000 samples?
To be honest i have really no experience with hardware counter.
The counter frequency (the maximum speed available) is configured by the Task in the background. In our case, the counter is set to detect edges, so it always uses the maximum speed available. If an edge occurs, the count value increases by 1, and this accumulated count value (stored as a binary number) is read by the DAQmx Read VI, and converted to meters. So if your encoder input is slow enough for the 80 MHz card to handle, you won't miss any ticks, even if you only read the value occasionally.
You can find further information about counters and encoders on these links:
Also if you can tell me the approximate frequency of your encoder signal, and how often you nedd the position info, I can do some benchmarking for you to see if your card is capable of the task.
ValkoA: Thank you very much for your answer now i think understand. The benchmarks is not necessary, I am sure that for quadrature decoder is my card enough, but the sensitivity is not good. This is of course problem of my electronic circuit. Because we have just interferometer with two analog outputs and PCI card which cant detect signal from two analog outputs simultenously, we use just this quadrature module. Our interferometer give us of course analog signal so it would be possible to get much better sensitivity than with quadrature module (with this we get only 40nm per step). If we could scan two signals from interferometer simultenously we could get not descrete steps (only 40nm) but smooth continuously position signal.
Converting analog sine/cosine to digital quadrature is a solved problem. The interferometer vendor I used in the past also sold optional high-precision interpoloators to produce sub-nanometer resolution in digital quadrature. (Note: don't expect this to be sub-nm *accuracy*, just resolution.) Many encoder vendors have various similar products. You'll need to check specs for supported sine/cosine amplitude & freq ranges to match against your interferometer.
I don't know all the ins and outs of the electronics in those things, but you would be hard-pressed to come close to matching their performance with analog data acq and software post-processing, even if you don't need to do near-real-time processing.