This depends what you want to do. Do you want your pic to be more or less dead for 30% of the time or do you plan to do more things?
The thing is that you should update your 3 servos for the arm every 20 ms to keep them in the right position. If you don't do that they can start to drift or loose torque so they will become weak. If all your 3 servos are in the max position you will be spending 3*2ms waiting and then you have 14 ms for other stuff... in fact your PIC will seem to be locked up for 15-30% of the time depending where your arm is.
What you need to have here is an interupt routine that executes every 20 ms and inside this routine you should use a second timer to generate a new interupt for each servo. With DT's interupts you can easily set this up. In your case at 20 MHz you would have a variable for each servo with a value from 5000 to 10000 (representing min and max) depending on your servo position.
All this of course comes down to if you have any timers availible. If you dont have that you better try to make a fast main loop where you use high and low (or =1 , =0) to set the pins manually.
I would go for the interupt solution, sure it might be a bit harder in the beginning but after you have made this you can write more or less anything you want in your main loop and that will not affect your arm in any kind of way. Your main loop just need to set the variable value for each servo and the interupt routine will keep the servos there for you.
I know is sucks that I didnt give you any code but I dont think it is time for coding yet until you have figured out what you want your PIC to do.
Maybe you also want your PIC to do other things such as following a line and then you can not wait for stuff to finish before you try to correct the heading again....
/me
Bookmarks