Ravi Pailoor wrote: > For one of my projects, I need to generate a square wave from 500 Hz > to 1200 Hz in steps of around 2 to 3 Hz. What is the acceptable jitter? If 16µS is acceptable jitter, use a crystal which is any multiple of 65536 x 4 = 262144 Hz such as 3.670MHz and I think you can use a "phase accumulator" technique where you add the frequency value (in Hertz) to a 16-bit accumulator 65536 times per second, the MSB of which is your desired square wave. A 3.670 MHz crytal would require this to be performed in 14 clock cycles (and no other calculations) but if you can tolerate a jitter of 32µS or use double the crystal frequency, you have 28 clock cycles in which to loop and it becomes much easier. -- Cheers, Paul B.