Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Using all 8 counters on the 6602.

I am looking at using a PCI-6602 counter board for an encoder measurment application.  I would like to be measuring many different aspects of the encoder, and plan to use all 8 counters avalible.  Each of these counters I would like to have the same source (which is actually a refrence encoder of much higher resolution).  This refrence encoder, my source, I would like to use with the x4 encoding feature in the software, to maximize the counts I send to the source.  I will probably be using DAQmx and VI Logger Lite, then exporting the data to excel for analysis (but not positive since I havent been able to evaluate the DAQmx or VI Logger software yet).
 
I am wondering what my best way to wire and configure the source would be.  Can I just wire it once to the counter card and then in software assign it to all 8 counter?  Should I wire the refrence encoder to all 8 source inputs?  Should I wire the refrence encoder to the first source input, then use the first source output to the second source input, and so on?
 
Also, I understand that the first three counters will use a DMA transfer, and the rest will use interupt.  I am doing buffered measurments on all 8 counters.  They do not all start and finish at the same times, but  commonly 3, up to 5, may finish at the exact same time.  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 doing this (P4 2.8 GHz, 512mb, windows 2000)?
 
 
Thank you all for any input you may have.
 
Garrett
 
0 Kudos
Message 1 of 41
(6,358 Views)
I'm not sure I understand what you expect your reference encoder "Source" signal to do in this set of measurements.  When you talk about sharing it among your 8 measurement tasks, that's a different kind of thing than when you talk about setting it up in X4 encoding mode.
 
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.  If so, you'll need to physically wire the signals in parallel to each of the 8 counters' default inputs.  The 6602 requires quadrature encoders to be physically wired to default pins (unless that's somehow changed in a very recent version of DAQmx).  So channel A must be wired to the 8 default SOURCE pins, channel B must be wired to the 8 default AUX pins.
 
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
Not exactly.  The count is recorded to the buffer at each Gate signal, aka each Sampling Clock edge.  Because the 6602 has a very small hardware FIFO buffer, the count value must be immediately transferred to system RAM.  3 of your counters can do this using DMA but the other 5 will need to use interrupts.
 
I haven't done this sort of app myself, but based on past postings you might expect to be limited to perhaps single digits of kHz sampling rate.  Short "bursts" of samples may manage a higher rate.
 
What kinds of measurements do you want to do with your 8 counters?  How does your 1 master encoder act as a reference?  In the past, I tried some fairly fancy timing-based measurement tasks which in the end didn't produce any better results than the combo of much simpler measurements plus interpolation.  Perhaps there are other ways to accomplish the needs of your app?
 
-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 41
(6,355 Views)

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

0 Kudos
Message 3 of 41
(6,356 Views)
One more question.
 
Looking at the pin out diagram for the 6602 (specifically, Figure 4-5 in the 6602 Manual) it appears that if you use the encoder mode you wire (for any particular counter channel) A to the source pin and B to the up_down/aux pin.  This would mean I am unable to use the gate to start aux to stop method of recording data, correct?  Or is it possible to use another one of the avalible PFIs for the aux?
 
Thanks! 
0 Kudos
Message 4 of 41
(6,349 Views)

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.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 5 of 41
(6,342 Views)

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

0 Kudos
Message 6 of 41
(6,338 Views)

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.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 7 of 41
(6,324 Views)

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.

0 Kudos
Message 8 of 41
(6,321 Views)

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.

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 9 of 41
(6,317 Views)
Okay..I think I see.  What I can do is with my refrence encoder, along with my A and B signals is send my Z, so that all of the counters start on the Z and therefore start at the exact same time.  Then connect the test encoders A to any PFI and B to any PFI.  I could hook up all kinds of other things too, such as communtator outputs, and measure them the same way. 
 
Speaking of, I have future application where I will want to measure not only A and B signals from my test encoder, but also 3 commutator outputs.  That means I need to record both high and low for 3 outputs, meaning I need 6 additional counters.  If I started with a 6602, could I later add in a 6601 card for an extra 4 channels, or would it be better to get another 6602  (6602 uses a 20MHz timebase and the 6601 uses a 10MHz)?
 
Thank you again Kevin.

Message Edited by Garrett K on 06-14-2006 04:04 PM

0 Kudos
Message 10 of 41
(6,315 Views)