> >I need to design a system that will work on either 50 Hz or 60 Hz. > Not yet, but I'm thinking about it. I'm considering using a 32KHz > pic so it can keep time well enough during power outages with the > RTCC. The mains will then provide the primary timebase. I just don't > know if 8k instructions per second will be enough. My plan is to tie the AC mains through a couple of 1 meg reistors in series (so if one of them fries in the UL required shorted component test it doesn't fry my chip!) to the TMR0 input. On bootup I'll set the TMR0 up for external triggering, start counting when it reaches 1 to synchornize with the line, then time it. Instead of setting a flag, I'll just stuff a timing value into a variable that I need later (easier, IMHO). One problem might be if there's a nasty line hit during my calibration routine, the frequency could be way off. In my case as long as this doesn't cause danger, just annoyance, this would be OK. One other problem is with power relays (which I use). If you trigger a relay at the same spot on the AC sine wave every time it's similar to switching DC. One contact of the relay tends to plate out on the other, resulting in pitting and reduced life. I've been warned to introduce a time delay so the relay switches at different polarities. Is this a fairy tale from an overzealous relay salesmqan or has anyone seen suych a problem? -- Lawrence Lile Download AutoCad blocks for electrical drafting at: http://members.sockets.net/~llile/index.htm