1 kHz PWM signal

Hey y'all, I'm trying to create a 1kHz PWM to control a firgelli L12. First time using an Arduino - it should be simple but I'm pretty sure the frequency is off judging by the the way the actuator is spazzing about (it sort of goes to the configuration but then keeps on making slight movements rather than sitting still). Here's the code:

pinMode(10, OUTPUT);

TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11) | _BV(WGM10);
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS11) | _BV(CS10);

OCR1AH = 0;
OCR1AL = 250;

OCR1BH = 0;
OCR1BL = 30;

So I was hoping the timer would count up to 250 and then reset. Any idea what I've missed?

The count is zero-relative so if you want 250 you need to enter 249.

I just tested that, and with 249 you get a 1 kHz signal with a 12.4% duty cycle. If you were hoping for a 12% duty cycle make the 30 to be 29 for the same reason.

On an Arduino with a crystal those settings produce 996Hz, using OCR1A = 249 gives 1kHz.

If you are using an Uno with a resonator expect +/- 0.3% accuracy - I can't imagine the device cares about the precise frequency though, I think it is LPF'ing it.

The actuator is spec'd to 0.1mm, so if the variation is below that level its perfectly in-spec.