Quote:
Originally Posted by 3dude_2231
if a 4MHz = 1MHz internal clock,
so with a 1:1 prescaler I should get 1 sample every 1 mS.
if I'm correct, a servo's pulse is between 0.9mS and 2.1 mS,
meaning I need something quicker, am I correct?
|
You've got the right idea, but the wrong numbers.
First correction: a standard hobby servo signal has a pulse width that varies from 1 to 2 milliseconds. If you want to measure that range with eight bits of precision, you'll need a resolution of 256 counts per millisecond.
Second correction: with the clock running at 1MHz, each cycle is one
microsecond. That's almost four times as fast as the task requires. If the processor you're using can measure pulses using the raw clock speed, you'll be fine with a 4MHz crystal.
(If you're indeed using a different servo standard with only a 200 microsecond range from end to end, a 1MHz clock will still give you more than 7 bits of resolution.)