LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count edges and quadrature encoder

There is no reason that you can't read an analogue input and the read the counter (pretty much at the same time), we do very similar things as well.

I have looked at the specification sheet and the unit appears to be TTL compatible, requiring typically 55mA or so of current to power the device (if I have read the specification correctly). This will need to be connected to the +5v supply in the SCB68 and you should make sure that the switches inside the SCB68 are set correctly for this operation. There should have been a sticky label, you might want to photocopy it then stick it into or onto the SCB68 box.

Don't ignore the fact the digital ground and the analogue ground are seperate, this could also be a cause for unreliable operation. Don't be tempted to join them together, things get noisy and you get the sort of problems you are having. Don't forget that a shield on the cable should also be correctly connected otherwise noise will cause miss counts.

The other thing that some times people do, is continualy re configure the boards in software, this looks like unreliable operation when in fact its not. So make sure you initialise the board once and then enter a loop to read the board (both analog and digitally) then at the end of the loop de-allocate if required.

Better than your own code when trouble shooting, try using the MAX, TEST PANEL without your code running to confirm operation of your hardware. Its quite neat and will help resolve many interface issues without resorting to a 'single wire of code' I have to say that I prefer the Traditional NI DAQ panel for counter testing, but its really solid software and helps out a lot when debunking hardware problems (For NI-DAQmx use the input EDGE Counting DEV1/PFI8. You will see that you can read an anlogue input at the same time as counting if you set both operating at the same time.

Message Edité par Conseils le 01-15-2006 09:47 PM

Message 11 of 27
(2,063 Views)

Hi Jon,

To answer your last question - yes you can perform analogue input and counting functions simultaneously, buffered aquisition or otherwise. Some low cost DAQ cards will only perform one aquisition at full speed if they only have one DMA control channel (direct memory access) - but your PCI-MIO-16E-4 board has three DMA channels, so you should have no problem there.

I have successfully used a quadrature encoder with a PCI-MIO-16E-4 board - but I employ "quadrature decoder" circuitry between the encoder and the DAQ board (decodes quadrature signals into count and direction signals). I also found I needed to add some "digital filtering" circuitry too, otherwise the counter would often miscount.

Connecting a quadrature signal directly to an E-series DAQ board (without quad' decoding) may appear to work, but is technically flawed - if your encoder "vibrates" (or has electrical noise) whilst at an edge on the source/count signal, the counter will count up several times "up-up-up" when it should count "up-down-up-down-up-down", because the count edge may be traversed forwards and backwards without the direction signal changing.

The new "M-series" boards, and the dedicated counter/timer boards, have the considerable advantage over the older E-series in that the former can decode quadrature signals without additional hardware (and also 32 bit counters rather than 24).

I've attached some old VIs that show how I configure, stop, and read the data using an E-series DAQ board (a PCI-MIO-16E-4) doing buffered position aquisition - remember I use quadrature decoding circuitry, but that doesn't change the software programming.

Mark H.

P.S. I work for a company division that makes position encoders... http://www.renishaw.com/client/product/UKEnglish/PGP-1113.shtml

 

 

 

Message 12 of 27
(2,049 Views)
It really doesn't get much better than this.
I hope I mentioned some or would have all of the above.

Definately 5 stars.
0 Kudos
Message 13 of 27
(2,047 Views)

Thanks Conseils,

I should apologise for repeating some of your last post - you see I didn't see it until I submitted mine because it was on page 2.

Thanks for the stars.

0 Kudos
Message 14 of 27
(2,043 Views)
Possibly the bigest advantage of this forum is the ability for anyone to contribute.

My goal is to help where I can and to learn when and what I can.

Your expert input may be just the help required, well done again, keep up the good work. 🙂

Kindest regards
Conseils
0 Kudos
Message 15 of 27
(2,041 Views)
I found my problem. My encoder was connected to a board that is being used on our machine under testing. From there is where I took my encoder signals. I didnt connect the ground on my board to the Digital Ground on my SCB-68 to create a common ground. Thanks for all the help and advice.
0 Kudos
Message 16 of 27
(2,035 Views)
I am having a hard time running these two things simultaneously, or even one after the other. I get an error that says, "Error -10461 occurred at AI Group Config -- Possible reason(s):
NI-DAQ LV:  The specified resource is unavailable because it has already been reserved by another entity." I'll post the program I am playing with.
0 Kudos
Message 17 of 27
(2,024 Views)

Try placing an analogue input configure, outside the loop.

 

 

0 Kudos
Message 18 of 27
(2,019 Views)
Error -10401 occurred at AI Group Config -- Possible reason(s):
NI-DAQ LV:  The specified device is not a National Instruments product, the driver does not support the device (for example, the driver was released before the device was supported), or the device has not been configured using the Measurement & Automation Explorer.
 
 
0 Kudos
Message 19 of 27
(2,017 Views)
With this attached program, I can get each device to run by itself. (Delete the other devices code so it runs by itself.) But I can't get them to work with each other...
0 Kudos
Message 20 of 27
(2,005 Views)