Mike, Actually, you'd have to use 4.1 uS and 4.2 Us because the period is 8.333uS. Your statement would put the period at 16.6 uS which would be about 60Khz. But if he can handle a slightly non symetrical wave form, this would be a good idea. The duty cycle works out to ~49% with 8.1uS as the high time and 50.6% with 8.2uS as the high time. Either way, it's very close. Regards, Jim On Mon, 29 January 2001, Mike Harrison wrote: > > On Sun, 28 Jan 2001 22:30:51 -0500, you wrote: > > >>The closest you'll be able to get (with the 20MHz clock) is 8.2 > >>microseconds. > > > >I beg to differ :) > > > >>This is an error of (8.3333-8.2)/8.33333 = about 1.6% > >>The actual frequency would be 121.951 KHz. > > > >However, if you used 8.4us (1 more instruction), you could get 119.047 KHz, > >which is only 0.8% error. > > > >>12.000MHz or 18.000MHz would work fine. > I didn't see the original question, but if you used 8.2uS high and > 8.4uS low, that would give 8.3uS = 120.481= 0.4% out. > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. jim@jpes.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.