hello
I face problame in controlling servo motor
I use pic16f877a programming by mikroC
I need the motor to move (0 , 90, 180) degree is the following code correct or not??
if not please help me as soon as possible
you should also tris first before port. Tris will set the i/o to whether it is input or output. Port will set te initial values to the respective port. =)
thanks john blue for trying to help me
I appreciate that,but i try the sample code that you post and give me same as the before result .
I try different code without PWM it give me good result
I do not program in C, but I do work with RC and servos.
Most servos have range of control from 1ms to 2ms with 1.5ms being the middle settings. (some can operate slightly outside these ranges). I would say that your range of 2500us could be outside the scope of the servo.
They normally have a complete cycle of 20ms (include PPM pulse).
i think why it keep moving because your code is repeat the cycle..
use some "if" command and at a button switch to your hardware temporarily to try your code..
I do not think the repeat is the issue, that is the way servo's work. They normal operate with complete cycle of 20ms, in a normal rx setup. Try dropping the second delay to 18ms in the code example to see if that resolves it.
You might see a slight jitter depending on acturate your clock is.
I try all advice
and at the end I think the power supply is the problem
but other problem is I can't reach 0 and 180 degree and I can reach 90 if the delay=1500 us??
I'm very happy when I see someone try to help me
thanks alote for everyone