stegla
Dec 27, 2007, 09:38 AM
A question for you PIC programming experts..........
I'm using a pic12f683 o/p to drive a servo with the usual 1ms to 2ms pulse width and 20ms frame-rate.
I am taking the 6 most significant bits from an A to D convertor........ the AtoD result is used to access a 64way lookup table to give me a number that is inserted into Timer2 to give me my pulse width. Which all works fine.
Servo trim was an easy feature to implement just by adding or subtracting a number to the result.
BUT (here is the question)......... How can I implement variable rates?
For the servo to always centre in the same place the 1.5ms pulse uses a figure of 7Fh from the look-up table. The 7Fh centre figure must never change but I would like to compress or expand the numbers either side to give me variable rates?
Any thoughts?
Thanks
Steve
ps I have written a 2nd look-up table to give me roughly 70% rates and a switch to jump betwwen the two................but this is an inelegant solution.
Steve
I'm using a pic12f683 o/p to drive a servo with the usual 1ms to 2ms pulse width and 20ms frame-rate.
I am taking the 6 most significant bits from an A to D convertor........ the AtoD result is used to access a 64way lookup table to give me a number that is inserted into Timer2 to give me my pulse width. Which all works fine.
Servo trim was an easy feature to implement just by adding or subtracting a number to the result.
BUT (here is the question)......... How can I implement variable rates?
For the servo to always centre in the same place the 1.5ms pulse uses a figure of 7Fh from the look-up table. The 7Fh centre figure must never change but I would like to compress or expand the numbers either side to give me variable rates?
Any thoughts?
Thanks
Steve
ps I have written a 2nd look-up table to give me roughly 70% rates and a switch to jump betwwen the two................but this is an inelegant solution.
Steve