Hi, i connected a servo signal to RD7 in PIC18F4455. I have done the experiment for the servo movement left = 500us, right = 2ms. I use the delay to work out the pulse but it doesnt work. The servo was just stop here. Is there any problem with my code? how can i fix it?
void main (void){
TRISD=0b00000000;
PORTD=0b00000000;
PORTDbits.RD7=0;
Delay1KTCYx(5); //delay for 20ms
PORTDbits.RD7=1;
Delay100TCYx(5); //delay for 2ms
while(1)
}
Try connecting it an LED in series with 220 ohm resistor instead of the servo pin. Set the delays to what you think will make it blink at 1 Hz. This will tell you if the chip is running, if the port is working as an output, and if the timing is what you think it is.