Motors, Mechanics, and Power
Problem reading an encoder correctly
Topic: Problem reading an encoder correctly
(Read 3950 times)
Re: Problem reading an encoder correctly
May 24, 2012, 02:35 am
If you try to use any other method other than interrupts you will not be able to do anything else because of the non-controllable timing of the transitions of the encoder signals. If they are that predictable then they aren't really needed.
Interrupts will keep counters abnd such updated without any interaction form you. You can use the value that is set to do whatever work you want done.
The higher the frequency of interrupts the slower other processing will take place, but it is assumed that you really want the encoder to give you very accurate results. If the encoder frequenct is too high then you might consider going to a lower count encoder and lowering the interrupt overhead. More (as encoder counts) is not always better, especially when you have limited processor power to deal with the interrupt and other functions.
I have worked on OLD CNC machines that used 50 line encoders because they lacked the processing power that would have been required for higher count encoders. Used on Oxy-fuel cutters and did a great job.