11 Further Development
The code accompanying this application note sets up the device according to the quadrature decoding scheme. It also shows the conversion of the count and direction values to a physical encoder angle in a polled fashion. Described below are some suggestions for additional features that could be added if required.
Suggestions for further improvements:
- Move conversion of physical position or angle to an RTC-interrupt to be executed according to application needs
- Add sleepwalking for reduced power consumption when no CPU is needed
- Add estimation of encoder speed. This can be done by inspecting the difference in encoder counts at known time intervals, for example, based on periodic interrupts from the RTC.
- Add support for index-pulse detection to increase robustness by setting the counter to a known value when the pulse is detected. Accuracy can also be increased by using the index-pulse as an accurate reference point.