Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Is the PCI-6251 card capable of reading two encoders at the same time?

I am working on a project where I must read two encoders simultaneously.  The bread board that is attached to the Elvis box has two counter source terminals, so I assumed that it was capable of reading two encoders at the same time.  However, my team and I have tried writing different programs using the two counters, but there's always an error.   Why can't I read two encoders at the same time?
0 Kudos
Message 1 of 13
(5,403 Views)

Makotoz,


Yes the M-Series cards have two counters, so the card will support two encoders. What is the error you are getting, and how (programming-wise) are you trying set up the measurement? Feel free to post a slimed down version of your code.

-GDE

0 Kudos
Message 2 of 13
(5,393 Views)
GDE,
 
Basically we use a slightly modified version of the Count Digital Events example program.  The only thing we change to the program is adding a DAQmx Connect Terminals to make the accessible PFI terminals on the board to a different needed PFI# such as PFI10 and PFI11 (These are not shown on the ELVIS prototyping board).  Then we copied the program and pasted it in the same window to run two sub programs at the same time. (Please refer to attach file.)  This is the program we wrote to try and read two encoders at the same time.
 
Here is our set up connections with ELVIS prototyping board and encoders
Encoder#1
+5V - Banana C - DAQ Vcc
Gnd - Banana D - DAQ Gnd
ChA - Banana A - CTR0_SOURCE
ChB - Banana B - PFI1 (actually PFI10 CTR0_AUX)
 
Encoder#2
+5V - DAQ Vcc
Gnd - DAQ Gnd
ChA - CTR1_SOURCE
ChB - PFI2 (actaully PFI11 CTR1_AUX)
When we run the program, an error comes up as I stated before.  I can't give you the error statment that pops up as of now, but if you still need to know what it says, I'll try to run the program again next Tuesday (May 30th).  Then I'll let you know the exact statement of error.
0 Kudos
Message 3 of 13
(5,390 Views)

Makotoz,


Is there any specific reason you must use that routing that you are, because that is what is causing your problems. I have taken the basic count events example here and set it up for 2 encoder measurements. It runs just fine on my end. So take a look at it, and see if that helps you out.


-GDE

0 Kudos
Message 4 of 13
(5,364 Views)

GDE,

We are using Labview 7 and cannot open your file.  Is it possible for you to save it in a Labview 7 file?

 

0 Kudos
Message 5 of 13
(5,352 Views)
My apologies here it is for LabVIEW 7.0.

-GDE
0 Kudos
Message 6 of 13
(5,339 Views)

Hi GDE,

I was able to open the program with Labview 7.1.  I will be attempting to run the program later today, but I would like to ask you about the connections.  Before I was using PFI's to access counter_aux 0 and 1.  Do I still use the same connections set up with my Elvis prototyping board?  I notice that you didn't use any PFI switch ups in your program like I did to access those counter_aux terminals that are not available on my prototyping board.

If I don't hear from you today, I'll still try it out and report back to you. 

Thanks for all your help thus far.

Makotoz

 

0 Kudos
Message 7 of 13
(5,332 Views)
GDE,
 
I attempted running your program after adding in Write Labview Measurement file on the right hand side.  I ran the program and began rotating my two encoders.  The program read both encoders simultaneously, but it could not sense direction. 
 
How do I make is sense direction?
 
I tried doing it on my own by incorporating the VI DAQ connect terminal in the program to access counter0_aux and counter1_aux on my Elvis prototype board.  However, the following error was shown.
 
 
Possible reason(s):
Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Property: CI.CountEdges.Term
Property: CI.CountEdges.ActiveEdge
Source Device: Dev1
Source Terminal: PFI3
Required Resources in Use by
Source Device: Dev1
Source Terminal: PFI1
Destination Device: Dev1
Destination Terminal: PFI10
Task Name: _unnamedTask<C>
 
 
 
 
Makotoz
0 Kudos
Message 8 of 13
(5,327 Views)

I have no knowledge at all about your "Elvis" prototyping board, so the only help I can think to offer is something else I spotted.

The error message you got refers to your task as "CI.CountEdges".  If you have quadrature encoders, you should be configuring your counter task differently.  You want to use one of the "position" modes rather than the edge-counting mode.  You can select either linear or angular position, whichever makes more sense for your app.  There are shipping examples to look at also if you search for terms like encoder or position.

I'd also recommend using the default pins if at all possible.  It's one less complication while you're troubleshooting your problem.  Once you get it working on default pins, *then* try configuring the pins you'd rather use.

- 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 13
(5,315 Views)

Kevin P,

Thank you for your response.  The encoder is not a quadrature.  There is no z-connection, so I wasn't able to use the "position" modes.

Do you have any other suggestions?

Makotoz

 

 

0 Kudos
Message 10 of 13
(5,293 Views)