Umm... Jason. Have you ever controlled a servo with a microcontroller? Very weird advice!Instead of controlling it straight put a transistor on the pic pin and connect the servo to it and 5v also so you toggle the transistor which in turn controls the servo. I think you would need a mosfet. But heh im not 100% sure not even 20% sure but at least its a thought.
#include <system.h>
#pragma CLOCK_FREQ 20000000
#pragma DATA _CONFIG1H, _HS_OSC_1H
#pragma DATA _CONFIG2H, _WDT_OFF_2H
#pragma DATA _CONFIG4L, _LVP_OFF_4L
void main(void)
{
int i;
trisb=trisc=0;
while(1){
for(i=0;i<50;i++){ //50 pulses 1.5mS - center
latb.0=1;
latc.3=1;
delay_ms(1);
delay_us(200);
latb.0=0;
latc.3=0;
delay_ms(18);
delay_100us(5);
}
delay_ms(100);
for(i=0;i<50;i++){ //50 pulses 1mS - cw
latb.0=1;
latc.3=1;
delay_100us(3);
delay_us(80);
latb.0=0;
latc.3=0;
delay_ms(18);
delay_100us(7);
}
delay_ms(100);
for(i=0;i<50;i++){ //50 pulses 1.5mS - center
latb.0=1;
latc.3=1;
delay_ms(1);
delay_us(200);
latb.0=0;
latc.3=0;
delay_ms(18);
delay_100us(5);
}
delay_ms(100);
for(i=0;i<50;i++){ //50 pulses 2mS - ccw
latb.0=1;
latc.3=1;
delay_ms(2);
latb.0=0;
latc.3=0;
delay_ms(18);
}
delay_ms(100);
}
}
Huh? That has nothing whatsoever to do with servo control.Take a look at this page
Add pull up resistors to the PIC outputs, to help them get to 5v.
No, and no. Don't do that. Unnecessary, and probably will make your servo not work at all.I was just thinking the servo inputs might be loading the PIC down. A small pullup might just get the high to (near) 5v, whilst still allowing the PIC outputs to go to 0v low. It would need suck it an see experimentation
From my other post:
ut heh im not 100% sure not even 20% sure but at least its a thought.
pullups bad idealMaximum output current sunk by any I/O pin..........................................................................................................25 mA
Maximum output current sourced by any I/O pin ....................................................................................................25 mA
Maximum current sunk by PORTA and PORTB (Combined)................................................................................200 mA
Maximum current sourced by PORTA and PORTB (Combined)...........................................................................200 mA
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?