07-19-2007 07:45 AM
I am trying to find information on how to connect the quadrature signals from an encoder to the counter inputs on a USB-6210 for position measurement.
I haven't been able to find anything specific in the owners manual or the NI web site.
The DAQ assistant (
but the 6210 manual only shows inputs PFI-0 thru PFI-7.
Any help would be appreciated.
Thanks
Brian
07-19-2007 08:38 AM
- A = PFI0
- B = PFI1
- Z = PFI2
- A = PFI3
- B = PFI2
- Z = PFI1
07-19-2007 09:57 AM
JB,
Thank you.
Your hookup info works.
It's strange even after I created another position task in max it tells me to use the PFI's I don't have.
Thanks again.
Brian
10-27-2009 12:04 PM
10-27-2009 01:11 PM
By the way, I have also tried
DAQmxSetCIEncoderAInputTerm() to try to change the pin routing on Counter 1 and get similar errors about routing.
10-29-2009 01:44 PM
Hello N3OX,
You mentioned that you tried using the DAQmxSetCIEncoderAInputTerm function but still received an error. What was the error that you received? The reason I'm asking is because I tested this in LabVIEW (as I am more proficient in LabVIEW than I am in C) and was able to get it working without any errors. What I did was use a property in LabVIEW, equivalent to DAQmxSetCIEncoderBInputTerm and DAQmxSetCIEncoderZInputTerm, to set both of those terminals on counter 1 to PFI 4 and PFI 5. Terminal A doesn't need to be changed because it's default terminal (PFI 3) doesn't overlap any PFI lines on counter 0. Once I did this I was able to resolve error 89137, but you will still receive an error stating that an external source must be used for the counter sampling clocks. To resolve this I created an analog input task and used ai/SampleClock as the timing source for my counter tasks. Try this out and let me know if you encounter any problems.
Regards,
10-29-2009 02:57 PM
Brandon,
That partially works in the sense that it compiles and doesn't throw errors. However, I get no "encoding" on the second encoder. Now that I've tried it and know that I'm using the proper functions I think I see the problem more clearly. I have a hardware problem. What I don't know is if it is a "hard" hardware problem or a "soft" hardware problem. Here's what I mean:
On PFI3 (A) which I set explicitly using DAQmxSetCIEncoderAINputTerm(), when I run the code and use a scope on that terminal to check the encoder signal,
I get a good 0-5V transition. On PFI4 and PFI5 (B and Z, set by the BInputTerm and ZInputTerm versions of above), I get only a signal of 0-100mV. It's not a problem with the encoder itself ... if I disconnect it from the USB-6210 those lines work fine.
This implies that I'm running my lines into a fairly low load impedance, 10 ohms or so (I have 2.2kOhm pullups on my open collector encoder).
The manual seems to suggest that terminals 0,1,2, and 3 are inputs and terminals 4,5,6, and 7 are outputs. This occurred to me but then I found the other thread I linked to, which suggests success with LabView. I took that to mean that the whole solutiion worked, but I suppose that user never came back and said that everything worked out fully. Maybe they just gave up? The routing table implies that connections are possible.... but perhaps that is in error?
So, can the physical terminals corresponding to PFI4,5,6 and 7 *really* be used as inputs? If so, is there another configuration (disconnection? direction change? ) step required in software that needs to
be explicit in C but is implicit in LabView?
I can swap out for a second USB-6210 without too much trouble to check to see if it's a "hard" hardware problem in the sense of
broken inputs, though to date the digital inputs on this box have never been used for anything so it's unlikely we broke them.
If the physical terminals for PFI 4,5,6 and 7 can only be used as PFI output, then there is no way to connect two working A/B/Z encoders to this unit.
As it stands, if the unit is working properly, the 'scope suggests that I'm hooking input lines to low impedance digital outputs that are held at low level.
Thanks,
Dan Zimmerman
10-30-2009 02:52 PM
Well I think the hardware does NOT actually allow two quadrature encoders to be used simultaneously on a USB-6210.
In my application, I only really need to know the speed of the second encoder, not direction or position, so I am going
to use a Count Edges channel on PFI3 to count the A channel of one encoder in conjunction with the A/B/Z encoder channel.
This works fine.
Thanks for the help.
Dan Zimmerman
10-30-2009 04:28 PM
Hi Dan,
As it turns out the USB-6210 FPI lines are input or output depending on which digital port they are on. So, PFI <0...3> are on port 0 which are Input PFIs only, and PFI <4...7> are on port 1, which are output only. This is why the default pins for those A, B and Z inputs on counter 1 are still on port 0. Unfortunately there is no way around this issue for the 6210. There are other 621x cards that have up to 8 input and 8 output FPIs, like the the 6218.
There is actually a little bug in the DAQmx driver, for this situation, which I reported to R&D. Currenlty, like your application and Brandon's, if you specify PFI 5 and PFI 6 to be used as inputs for the encoder measurement, the driver does not throw an error, however, it certainly should because PFI <4...7> should not be able to be able to be used as input lines, due to the fact that they are PFI output lines.
I'm sorry for the inconvenience, but I hope this clears things up.
Chris W
10-30-2009 04:31 PM
Chris, thanks.
It's good to know for sure and useful to have in the forum archives that it is NOT possible to use two
simultaneous A/B/Z encoders with the USB-6210.
Thanks,
Dan