Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

program in c to read quadrature encoder didn't work (NI 6220)

Solved!
Go to solution

Thanks -Erik S

 

I have 2 encoders and I want to read them by NI 6220 this error appear when I use one or more encoders

 

I tried to change sample rate but the same error appear .

 

Regards,

Alaa Khalifa

 

 

0 Kudos
Message 11 of 17
(3,453 Views)

What range of sample rates did you try? Also, how are you currently sending the data to the computer? 

 

-Erik S

0 Kudos
Message 12 of 17
(3,439 Views)

Dear -Erik S,

 

what do you mean by " how are you currently sending the data to the computer?"

 

I tried sampling rate of  1  10  100  1000  1000000 1000000000 and this give the same error

 

Regards,

Alaa Khalifa 

 

0 Kudos
Message 13 of 17
(3,432 Views)

I apologize for being vague. I meant what kind of data transfer mechanism are you using? The error states that DMA or USB bulk may be better options. Here is a link that explains the differences between all of the data transfer mechanisms:

 

http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/datatrans/

 

Also, can you post your code so that I can take a look at how the DAQ assistant is set up?

 

-Erik S

0 Kudos
Message 14 of 17
(3,420 Views)

Dear all,

 

I have problem in my project.

I need to read quadrature encoder to make PID position controller on a motor .( I use NI pcie 6323 card)

I use c language and the code in the attached file .

when I run the program the following error appear after little time.

 

 

Error -201314 occurred at DAQ Assistant

Possible Reason(s):
Multiple Sample Clock pulses were detected within one period of the input signal.
Use a Sample Clock rate that is slower than the input signal. If you are using
an external Sample Clock, ensure that clock signal is within the jitter and
voltage level specifications and without glitches.


property: RelativeTo
Requested Value: Current Read Position
Property: Offset
Requested Value: 0

 

 

Best Regards,

Alaa Khalifa. 

Egypt-Japan University for Science and Technology (E-JUST).
M.Sc. Graduate Student.
0 Kudos
Message 15 of 17
(3,348 Views)
Solution
Accepted by topic author khalifa88

I think you might be misunderstanding the purpose of the sample clock (from your PDF, you have it set to the same input as your encoder input).  You either 1) don't need the sample clock at all or 2) should be using a fixed rate clock (probably generated by another counter on the DAQ device) if you need to sample at regular intervals.

 

 

You're getting the error since the clock signal (your encoder A input) is noisy (which is typical for a signal coming from a quadrature encoder).  If you really needed to sample off of this signal you would need to configure a digital filter for sample clock input (but I don't believe this is what you really need to be doing anyway).

 

 

Best Regards,

John Passiak
0 Kudos
Message 16 of 17
(3,341 Views)

Thank you  very much  John_p1

 

I don't need the sample clock at all.

I try it and worked well.

 

 

Could you tell me about function to generate number of pulses (control signal) instead of make it by  my hand

and consume time for waiting in writing pulses.

 

Thank you

 

Best Regards,

Alaa Khalifa. 

Egypt-Japan University for Science and Technology (E-JUST).
M.Sc. Graduate Student.
0 Kudos
Message 17 of 17
(3,334 Views)