i want to rotate a servo motor to the predetmined angles can i do that if not suggest me another kind of motor that helps me to achive this
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
i want to rotate a servo motor to the predetmined angles can i do that if not suggest me another kind of motor that helps me to achive this
Hi Sudheer!
Sudheer kumar Vuppula said:i want to rotate a servo motor
What do you mean by "servo motor"? A real motor or one of those R/C servos?
Sudheer kumar Vuppula said:predetermined angles
In the case you're talking about one of those R/C servos, this isn't a problem at all. They expect a PWM input signal with a period of 20ms and a pulse with varying from ~1ms to ~2ms for ~180° movement:
But they cannot rotate, only like this:
The input signal can easily be generated by a timer module and OUTMOD_7 - here is an example generating the required pulse:
The only thing you need to change is
TA0CCR1 = 1500; // Duty-cycle: 1000 = ~1ms, 1500 = ~1.5ms, 2000 = ~2ms
Since every servo behaves a little bit different, you might need some sort of calibration to find the exact values. Once you found them you can work with a formula like this:
#define PWM_VALUE_0_DEGREE 1000 #define PWM_VALUE_180_DEGREE 2000 void update_servo_angle( uint8_t degree ) { if( degree <= 180 ) { TA0CCR1 = (PWM_VALUE_0_DEGREE + ((PWM_VALUE_180_DEGREE - PWM_VALUE_0_DEGREE) * degree) / 180)); } }
You can expect the servo to behave nearly linear. If not you can also add some more calibration points for 0, 45 and 135 degree, for example.
If this is not what you're looking for, please describe your application a little bit more in detail.
Dennis
**Attention** This is a public forum