06-14-2006 08:03 AM
06-14-2006 08:33 AM
If I understand correctly, as soon as the counter finishes recording, the count is recorded to the buffer, and its transfered to the computer. Will I be bogging down my system
06-14-2006 09:35 AM - edited 06-14-2006 09:35 AM
Kevin, thank you for your very informative responce.
You were correct when you said "What makes sense logically to me is that you might want all 8 counter tasks to increment/decrement in the X4 mode based on signals from this reference encoder."
Perhaps this would be easier if I gave you some more information about my project. What I want to do is analyse quadrature encoder acuracy. A very good and acurate time based system is very hard to build, mostly from the mechanical perspective, so in lue of that I have decided to use a high resolution encoder as my refrence. This is a 26 bit quadrature encoder (67 million divisions per revolution, which is 5 millionths of a degree incriments), and becuase of its acuracy I am going to call its readings 'true' and use is as a refrence encoder for my test encoders to compare against. What I would like to do is feed this refrence encoder to the counter (which means feed it to the source input on a counter, and actually to all 8 counters). I would like my test encoder to act as the gate (to start and stop recording counts). This will allow me to do things like feed A signal into a gate. When A goes high, the counter will begin counting, and when A goes low it will stop. This will give me a number of courts (pulses from the refrence encoder) for which A was high. Multiplying this number of couts by 0.000005º will give me the width of my A high signal. In another counter I do the same thing, except with my A signal on an inverter, so I will measure the exact same thing except on A low. I can then repeat this for B high, B low. Also, using the gate to start and aux to stop features, I can measure A to B and B to A transitions. This, so far, only requires 6 counters, but I thought since I have the extra counters avalible anyways, I could do an A and B period measurment on the remaining two counters. I can quite easily cut down to 6 channels if this becomes system intensive.
I intend to be using this at a fairly slow speed, so even a few kilosamples per second will be acceptable, because the device isnt sending the signal from the counter continously, only the final count once it is put to buffer, correct?
When you say 3 counters can use DMA, the rest interupts, how exactally are those assigned? Do counters 0, 1, and 2 use DMA, or is it first come first serve? If so, lets say my counters 0, 1, and 2 send data and then are done. Time passes and then counters 3, 4, and 5 send data. Would the DMA be released from the first 3 counters, then be avalible for the next 3 counters? In my application I most often will only use 3 at a time, however, which three it is will be changing constantly.
Thanks again
Garrett
Edit: I forgot to mention that the x4 encoding feature on the car I only wanted to use for convience. I can easily build my own external hardware to do this for me, and just have one signal wire going to the counter card. Would this be better to do or does it not really matter? Wiring to all 8 counters isnt a problem for me, I was just wanting to know what was best.
Message Edited by Garrett K on 06-14-2006 09:39 AM
06-14-2006 09:45 AM
06-14-2006 11:53 AM
Thanks for the details. I don't think you can quite get where you want. Some of the measurements you describe are mutually exclusive from quadrature position measurement. However, it seems to me that you can get all the needed information from just 4 tasks, and only 1 of them will need to use interrupts.
You'd physically wire your reference quad encoder to 4 different counters. Each would be configured for position measurement using a digital "arm start" trigger (available in the DAQmx Trigger property node.) The difference is that their respective sample clocks would be defined differently. Each would sample off a different edge of your test encoder -- A rising, A falling, B rising, B falling.
So now you are buffering the quadrature-resolved position of the reference encoder at every edge of the test encoder. All of them reference the same 0 mark because they are all triggered together. So you can post-process to find out high times, low times, phase difference, etc.
The reference encoder needs both A & B channels wired to the 4 counters' default Source and Aux inputs. (Z, if present, would go to the Gate inputs). The test encoder would need its A & B channels wired to PFI lines that are allowed to be used as Sampling Clocks. I'm sure that the Gate inputs from 2 of the unused counters would be valid, but there are likely additional options if you want/need them.
I *think* DAQmx will attempt to assign DMA by default. I'm not sure if the later versions are smart enough to automatically change to interrupts when necessary, or whether it'll just give you an error. You can manually assign the use of interrupts through one of the DAQmx Channel property nodes. Oh, and any counter can be assigned either way -- kinda like first come, first served.
Once a task is configured to use DMA, I don't think it will release that DMA channel until the task is cleared. You can't bounce around reassigning DMA & interrupts among a bunch of live tasks.
-Kevin P.
06-14-2006 12:35 PM
Kevin, thank you again for your responce. I am a little confused on what you have said. What do you mean by a "sample clock". How I thought I had to do this was, for example, to measure A high, feed A singal into the gate, and then while A was high my counter would be running. Are you suggesting us the A signal as its own clock and compare it to the refrence encoder that way?
Thanks
06-14-2006 03:09 PM
The method you're describing would be called "pause triggering" under DAQmx. I'm not certain whether it's allowed during position measurement, but even if it is, I don't think it'll get you where you want to be. The problem is that each time A went high, you would just keep accumulating position counts starting from where you left off last time. There'd be nothing to indicate the # of counts per individual high time, info you'd need in order to characterize the accuracy of the test encoder.
The "sample clocks" are needed for performing buffered acquisitions, where the 6602 stores reference position data in a buffer each time there's a transition on a test encoder channel. If the term "sample clock" isn't familiar, it'd be good to read some of the tutorials here on how to get started with data acquisition.
The idea is that each of the 4 tasks will have count values that track the position of the reference encoder. Those counts will be buffered, aka "sampled", each time there's a active edge on the sampling clock signal. Since each task uses a different 1 of the 4 possible edges as a sampling clock, you'll get all the info you need. You'll have stored up the position of the reference encoder at each of the transitions of your test encoder.
-Kevin P.
06-14-2006 03:34 PM
Now I get it, thank you Kevin. I believe this is exactally what I want. I guess I rushed into asking the questions; I am trying to make a purchase decision fast, but I havent been able to evaluate the software yet (should arrive by fedex tomorrow).
For clarification, how I want to wire this is send my A and B from my refrence encoder to 4 counters on the source (A) and aux (B) pins. From my test encoder I want to send my A channel to two counters and my B channel to two counters, all on the gate pin. I will configure one counter for A rising, one for A falling, one for B rising, and one for B falling.
06-14-2006 03:57 PM
Re: wiring plan. Yep, you've got it!
(Technically, the test encoder only needs A & B to be wired in 1 time if the software config handles it right. I would actually recommend wiring to the unused counters' default pins. You may need to if you're using a Z-index pulse wired to the 4 position counter's default Gate pins.)
-Kevin P.
06-14-2006 04:02 PM - edited 06-14-2006 04:02 PM
Message Edited by Garrett K on 06-14-2006 04:04 PM