Im facing a problem in developing a algorithm for a sensor absolute encoder that need to count the number of rotation for example 5 rotation or 4.5 rotation (1 full rotation = 360degree)
The characteristic of the absolute encoder is, the change of degree in rotation will also changing the duty cycle width of the PWM ( eg. large angle of rotation will gives larger duty cycle width) which is output by the sensor. The data sheet for this sensor is found https://www.usdigital.com/products/ma3/
i want to develop an algorithm for detecting the number of rotation of the motor that need to be turned to the desired position. the mircocontroller for this system is PIC 16F876. my application is that the motor will need to turn more than 1 full rotation sometimes to achieve the desired position.
Im using CCS C compiler to write program in PIC,
so what is the algorithm that can be write in C to detect such an application?
can anyone give me an idea and solution?
Thes solution depends on the maximum rotational speed in your application. Basically the sensor gives an angle measurement, you have to count the overflows with detecting the direction. That implies more than two measurements per revolution, then a |delta| > 0.5 range indicates a position overflow, the delta sign gives the direction.
Sorry, i don't understand what you mean. how to count overflow with detecting the direction? why |delta|>0.5 indicates a position overflow? can you or anybody show me some example source code for this application?