Servo control is not that simple, there a lot in control theory that you must deal of. Closed loop instability is common and you must address it with a more sophisticated algorithm. It seems that a PID controller may be better suited for your problem. Have you tried to add a dead-band to your logic (simply tolerate the 3 degree error. If the position is inside the 3 degree band, then stop trying to correct it). Isaac Em 23/5/2012 00:11, yamanoor sairam escreveu: > Hello All, > > I had written to the list long time back regarding the drive of servo mot= or using a potentiometer and a PIC12F675. I was successful in doing driving= the same. I got back to working on this project and I am happen to face a = new problem. =20 > > When there is no load on the motor, it works perfect. When I load the mot= or, it keeps wobbling. I think the motor is not able to drive the load or t= here is a small slippage that is causing the problem. All I wanted to do wa= s that the motor should rotate between 90 and 180 degrees when a switch is = toggled. > > Should I just switch off the motor when it is near the desired position? = It looks like the motor has reached 3 degrees and trying to correct the ang= le and slipping off to -3 degrees. It keeps repeating this cycle. > > I am posting a snippet of the code: > > if(GPIO & (1<<3)) > { > if(servoVal>=3D(1499)) > { > servoVal =3D servoVal-(quotient*10); > } > // do_servo(); > } > else if(!(GPIO & (1<<3))) > { > if(servoVal<=3D(2300)) > { > servoVal =3D servoVal+(quotient*10); > } > //do_servo(); > } > > Sai > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .