I need an output clock at about 22.73 khz running at 90 degrees phase lag to an input clock. The input clock is also 22.73 Khz and may drift by 1 khz. The input is very intermittent and will skip cycles a lot. The output may not skip cycles and must sync with the input when available. Otherwise known as a software PLL. I have working code that will do this. however it is very clumsy and I am not sure how accurate. If someone is interested in looking at my code, let me know and I will send it. I did not publish it with this e-mail due to length. There may be nothing wrong with my code, but the more accurate, faster and smaller the better. Part number 16F84 @ 10 Mhz but will be upgraded to the 16F873 @ 20 Mhz when available. Gordon Varney