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)
}
PS:using Fosc=1MHz
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)
}
PS:using Fosc=1MHz
Last edited: