-
Servo Code problem
Hi, I recently wrote a program to control 12 servos. The program ran perfectly on my PIC16F84-A but when I tried to run it off my 16F88 it did not control all of the servos properly. The F88 caused some servos to move back and forth rapidly and others worked fine. I thought the problem could be in the fuse data but I looked through it and everything seemed to be in order (although I am not 100% sure). Does anyone have any ideas of what could be happening?
Thanks
P.S. My code looks something like this:
for i = 1 to 50
Low portb.0
Pulsout portb.0, 150
low bortb.2
pulsout portb.2, 150 ...
next i
-
Servo problem
I assume you are using a 4 MHz crystal where the PULSOUT unit time would be 10 uS per count giving 1500 uS for a centred servo.
Your code will loop extremely fast - way too fast for a servo thst is looking for a refresh rate around 50 per second.
Try putting
PAUSE 18
in youf FOR/NEXT I loop and it should centre the servo.
HTH
Brian