psecody
Member
Sorry if this question has been asked before but I've searched the forum and the internet for hours now and can't find anything to explain this to me. I also looked over Nigel's tutorial and I understand most of it but my problem is actually taking that and controlling a servo.
I understand that the servos run at 20ms periods and the first part is high and the second part is low and 1.5ms high would roughly be neutral on the servo. I understand all of that but what I'm getting confused with is figuring up the delays and how to actually program that. I've found a few articles talking about controlling a servo with a PIC but all of them are programmed in C or basic and I am trying to do it in assembly.
I'm using a PIC16F877A with an 8MHz oscillator. I looked here http://www.pyroelectro.com/tutorials/servo_motor/software.html and was trying to figure it out with those figures just replacing values for mine but I'm still new to micro controllers and aren't sure if I've figured these right. The part I didn't understand was the instructions per clock cycle is, how do you come up with those numbers? I looked on the data sheet and it said the 877a 20MHz 200ns instruction cycle and I think thats related but I'm not sure how.
Sorry for so many questions, I just thought I grasped the concept until I actually sat down and tried to program and failed miserably. I appreciate any help.
I understand that the servos run at 20ms periods and the first part is high and the second part is low and 1.5ms high would roughly be neutral on the servo. I understand all of that but what I'm getting confused with is figuring up the delays and how to actually program that. I've found a few articles talking about controlling a servo with a PIC but all of them are programmed in C or basic and I am trying to do it in assembly.
I'm using a PIC16F877A with an 8MHz oscillator. I looked here http://www.pyroelectro.com/tutorials/servo_motor/software.html and was trying to figure it out with those figures just replacing values for mine but I'm still new to micro controllers and aren't sure if I've figured these right. The part I didn't understand was the instructions per clock cycle is, how do you come up with those numbers? I looked on the data sheet and it said the 877a 20MHz 200ns instruction cycle and I think thats related but I'm not sure how.
Sorry for so many questions, I just thought I grasped the concept until I actually sat down and tried to program and failed miserably. I appreciate any help.