Hi Paul, I am working on a HOT project. I intend to use a 12C508 with internal oscillator. My problem as below. I have 2 pins of the PICmicro to select the tones. Totally I have 4 sweeps to generate. I have to generate the following sweep freq's. 1. 500 Hz to 1200 Hz - 3 Sec 2. 800 Hz to 970 Hz - 1 Sec 3. 1200 Hz to 500 Hz - 1 Sec 4. 2400 to 2850 Hz. - 0.143 Sec I have to check the DIP switch change to change the Freq band during my freq generation. I also have to maintain 15 % duty cycle. Could you expalin "phase accumulator" technique in a bit more detail or if you can give me code snipped to try it out on a PICmicro it would be great. Expecting to finish the project with some help Thanks for your guidance. Pailoor Paul B. Webster VK2BZC wrote: > 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.