Principle and application of photoelectric encoder