CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

what is the max speed of quadrature encoding

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ebrehe
Guest







what is the max speed of quadrature encoding
PostPosted: Thu Dec 04, 2008 7:29 am     Reply with quote

hi all,

I try to realize a quadrature encoder decoder without a QEI module. But I couldn't get success at above 8-9 Khz. How much speed can I get at most ? I need a speed like 100 KHz, is it possible just using interrupts (INT1, INT2) without any quadrature module ?

Thanks in advance.
Ttelmah
Guest







PostPosted: Thu Dec 04, 2008 9:36 am     Reply with quote

Yes, possibly.
Obviously depends on the processor speed involved, and what else you may want to do at the same time. I have in the past posted a quadrature decoder, using the global interrupt, and only saving a few registers, to give really good speed. This happily handles well over your 6KHz, _but_ I honestly have to say you would be much better off using external hardware, especially if you want to do anything other than handling the quadrature encoder. A search here will find details of this code.
What is involved for a 'hardware assisted' approach, will depend on whether you want to just decode one, two, or four edges from the quadrature system. If all four, then a proper quadrature decoder is the way to go. However if you only want two edges, it is fairly simple to generate 'left', and 'right' count streams using just a couple of logic gates, and feed these to the CCPs on a PIC. Details of this approach, are in a MicroChip application note about servo control.
It is worth also querying whether you are going to actually gain anything from such count speeds. There is a commonly 'missed' problem in quadrature applications. If (for instance), you are using a 40mm, 1024 line decoder, then you will only get a proper answer for angular position from this, if the bearings supporting the shaft, can guarantee it's position to better than the lateral displacement represented by 1/4th grid step on mask. So in this example, the mask has a pitch of (40*pi)/1024mm = 0.1227mm at it's edge, so your bearings, have to hold the shaft positioned to better than 30um. Few bearings supporting high rotational speeds will acheive this. Hence there tends to be three different scenarios:
1) Normal bearings - no poinjt in using really high line count encoders.
2) High accuracy bearings - not supporting high rotational speeds
3) High accuracy, high rotation speed bearings - _very_ expensive...

If you are not in number '3', you should perhaps query your design.

Best Wishes
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Thu Dec 04, 2008 12:27 pm     Reply with quote

I'm not sure how smart this is, but if speed is absolutely crucial and the processor hasn't got much else to do, you can sometimes solve a problem by sitting in a loop and polling an interrupt bit. In this case you could bring the two encoder phases to pins of Port B, and use the interupt-on-change feature but without an interrupt. Whenever the interrupt bit (RBIF) is seen to be set, clear it and evaluate the old and new states of the input, increment or decrement the postion, then store new in place of old.

But a lot depends on exactly how the system is configured. It certainly isn't the ideal way to do things.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group