>Micro uses RC clock & counter to generate a clock "tick" >source at say 100Hz. If there is not at least one 50/60Hz >pin input transition within two RC clock ticks then RTC >clock source will be RC ticks, else RTC will use 50/60Hz >ticks with divide by 50 or 60 to generate seconds. Seperate >code determines if input is 50 or 60Hz... or perhaps this >should be be a setup parameter as it could be too difiicult >to distinguish 50Hz from 60Hz without an accurate timebase. However I would also be tempted to have some sort of auto-calibration routine that checked the average rate of your internal 100Hz against the 50/60Hz. By using an average over a 24hr period you should be able to deal with RC clock variations as well. Should give your clock a more accurate time if the power is off for a significant length of time. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist