Problem to control servo motor

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hi everybody!!

actually i´m working to control a servo motor i read that the frecuency is 20 hz and the duty cycle is 1,1.5 and 2 ms
i´m using pwm16:

   


parameter pwm16
clock = 1,000,000
period= 49,999
duty cycle = 999-> 1ms->0°
                     1499-> 1.5ms -> 90°
                      1999 -> 2ms -> 180°

but the servo doesn´t work correctly don´t go to the correctly position and keeps vibrating and i don´t understand why,so if someone help me i´m really be glateful
i put my code if someone can check it

 

0 Likes
3 Replies
MR_41
Employee
Employee
First like received

Here are some pointers.

   

 

   

Have you observed the output of the PWM on an oscilloscope to find out if the expected frequency and duty cycle is being generated?

   

 

   

How are you deriving the 1MHz input clock to the PWM?

   

 

   

What is ClockSync parameter set to?  The right setting would be SyncToSysClk

0 Likes
ArvindK_86
Employee
Employee
10 sign-ins 5 sign-ins 10 solutions authored

 Hi,

   

 

   

Is the servo motor getting sufficient current?

   

 

   

If you are using the power from a DVK, make sure the regulator can supply the required current to the servo.

   

 

   

Also, archive (ZIP) your project and post it here, so that others can have a look at the code.

   

 

   

Regards,

   

Arvind

0 Likes
Anonymous
Not applicable

Problem solved in other post.

0 Likes