PIC Servo motor control

Thread Starter

Nadeeja

Joined Jan 24, 2012
1
Hi everybody,

So..I'm new here but I'll get straight down to business.
I'm using a PIC18f452 to control a servo motor using timers. I could use the PWM module but the point is to actually learn everything I can without taking the easy path.
So anyway I wrote the firmware in c18, it uses timer0 and timer1. The algorithm is pretty simple.
The software works well. I attached a LED to the output pin and it dims to the frequency I need.
However when I connect my servo motor to it, things get weird. It seems my pic constantly restarts with every pulse, but only when I connect the motor.
To make sure I added a pushbutton that will turn on a LED when pressed.Sure enough the LED turns on when the button is pressed and quickly turns off, meaning the PIC restarts.
This is driving me crazy...

Am I missing something? Any help is appreciated.

P.S - There's nothing wrong with the motor...
 

Markd77

Joined Sep 7, 2009
2,806
Sounds like the current that the servo draws is making the power supply drop. Even a fraction of a second is enough to reset the PIC. More capacitors may help especially close to the PIC.
 
Top