Help in C programming

Thread Starter

Johnyc

Joined Mar 26, 2008
2
Hi all,

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.

This sensor is use 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?

thanks

~Johnyc
 

beenthere

Joined Apr 20, 2004
15,819
I would get the data sheet for the encoder and figure out how to make use of it. One nice feature of absolute shaft encoders is that they have a indexer output that lets you know when they pass a reference angle.
 
Top