hi all
i am using a pic18f4520 board. I connected a springrc sm-s4315r continuous servo motor to port A.
i am just trying to control it to spin clockwise or anticlockwise but to no avail…it just doesnt move on its own. However if i give it a slight manual push in the direction corresponding to the pwm i programmed it to (<1.5ms clockwise), it will start to spin perfectly fine. it doesnt budge if i try to push it in the wrong direction.
i have attached my code below using mplab c18 compiler. This is assuming that a high pulse with duration below 1.5ms results in clockwise turn.
#define leftservo PORTAbits.RA0
void main (void)
{
while (1){
leftservo=1;
waitmis(5); //loop delay function, results in clockwise
leftservo=0;
waitmis(125);
}
}
void waitmis (int count) //Gives a delay of 0.15 ms
{
int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<25;j++);
}
}
anyone knows the problem? i have checked and the pin is sending out the pulse as per instructed.