Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Quadrature encoders

Hi,

I'm using a quadrature encoders with a PCI6025E board to measure an angle,
I want to use the COUNTER1 so I have connected line A of the encoder to PFI_3 and Line B of the encoder to LINE DIO7.

I have configure the 6025E with this code to read the counter 1 value :

status = GPCTR_Control(1, ND_COUNTER_1, ND_RESET);

status = GPCTR_Set_Application(1, ND_COUNTER_1, ND_SIMPLE_EVENT_CNT);

status = GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_SOURCE, ND_PFI_3);

status = GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_UP_DOWN,ND_HARDWARE);

status = GPCTR_Control(1, ND_COUNTER_1, ND_PROGRAM);

All the status code return by this functions are 0 and so OK.
But when I Get the counter value with GPCTR_Wathch().
When i tur
n the encoder in one way it count up well, but when i turn the encoder in the other way (down) I read a count that is is two times more than the count up (count down = 2 * count up) !!!!

Does someone have meet this problem before?
Any solution to solve this problem ?

Thanks.
dpasssounaud
0 Kudos
Message 1 of 2
(3,331 Views)
Hello,

Your programmation seems to be OK. And the connections too.

Please, test the program in the attached file and tell me about the results.

Sanaa T
National Instruments
0 Kudos
Message 2 of 2
(3,331 Views)