Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder signal counting using 6008

Hi,

 

I am trying to count the signal from encoder (HEDS-5500 w/ 500 CPR) using Digital Inputs of USB 6008. I made a reference from Quadrature encoder tutorial in http://zone.ni.com/devzone/cda/tut/p/id/3921 and modified some blocks for my application.

 

As you can see from the graph in the front pannel, my measurment is inconsistent, especially when motor is about to stop moving. Each cycle consists 2 revolutions, which should yield 1000 counts, but as appeared on the graph, the number of count is nowhere near that number.

 

I also tested encoder counting using the Counter example for 6008 and saw it worked properly. Can anyone tell me what I did wrong and a solution to fix this problem?

 

Thanks.

Download All
0 Kudos
Message 1 of 5
(4,756 Views)

Hi SHME,

 

I would just like to confirm that I understand where you are having the problem. You wrote your own code to test the encoder and it did not work: you are getting an inconsistent measurement. Then when you tried the example it does work correctly. Can you modify the example code to use in your application? Or is your question just wondering why your code gives inconsistent measurements?

 

Can you be more specific about which counter example you are using with the USB-6008? Is it this one?

 

Jeff P | Applications Engineering | National Instruments

0 Kudos
Message 2 of 5
(4,707 Views)

Hi Jeff-P,

 

Thanks for replying my question. I will describe the situation as much as possible.

 

I want to measure angular position of motor using quadrature encoder HEDS 5500 with the resolution of 500 CPR. I attached one of output channel of encoder (channel A to be specific) into a PFI0 on 6008 and tested using 'Count Digital Event.vi' It displayed right number of count when the motor turned 1 revolution.

 

Since I need to control two motors (4 encoder channels), I used digital input ports and programmed vi based on the tutorial I included (see position measurement). You can see my code on the attachment. I connected outputs from encoder directly into the digital inputs on 6008, executed code, but the number of count I obtained is far less then 500 (white line). This result is also on the attchment that has a graph. 

 

Besides incorrect number of count, my biggest concern is noise and sudden spike of measurement near the end of movement. I was not sure if this is a hardware or a software problem. Should I use HCTL 2020 decoder/counter for this problem?

 

Please let me know if you need to know more on my situation, and I will gladly tell you.

 

0 Kudos
Message 3 of 5
(4,699 Views)

Hi SHME,

 

Thanks for the more details regarding your application. I have just been looking through the data sheet for your encoder to determine how it works with LabVIEW and the 6008 and looking at your VIs to try and find out where the problem is occurring. To test if there is noise coming from your hardware, you can try opening the USB 6008 in Measurement & Automation Explorer and running the test panels to see what values you are getting from your device. I will take a further look at your VIs to see if I can find where you are having the trouble!

0 Kudos
Message 4 of 5
(4,679 Views)

Hi SHME,

 

so the USB-6008 does not have hardware timing, only software timing, so it will only sample as fast as windows executes your loop. Since your encoder has 500 measurements per revolution and you are measuring a motor, you are likely missing ticks. In order to sample that quickly you will need a device with hardware timing that can sample fast enough for your application. It will buffer the measurements that it takes and you can then process them with LabVIEW.

 

I hope that helps!

0 Kudos
Message 5 of 5
(4,657 Views)