I'd be surprised if no-one's done it. Should be easy to do; Basic points: Use a diode off one side of the mains transformer's secondary, through a largeish resistor, to a PIC pin, to detect AC cycles. (Keep the current through the protection diodes low so you don't mess yourself up, by large enough resistor value. 100kish or so?) Maybe use a jumper off another PIC pin to set 50/60 Hz? (Or could determine this by counting the number of cycles coming in during startup, in a known number of iterations i.e. known time period, to Guesstimate AC frequency. There's enough difference that you should be able to tell them apart!) Then you just need to count using BCD (or whatever's your preference), and drive your display or output device. (I'd use BCD if going to an LCD, probably easier to convert for most people.) Hope this helps without doing it all for you. Mark BAMBERG & MONSEES GbR wrote: > > This might sound a bit off-topic, but we're looking for a replacement > for the SAB 0529 which is a long-term-timer (up to 31.5 h, syncronised > to the 50/60 Hz mains), it was made by Siemens until 1992. As there > seems to be no direct replacement, we thought of using a PIC for > this. > So, did anyone ever made such a programmable long-timer with one of the > PIC ? > > Any informations welcome. > > regards, > Reelf Monsees > -- > BAMBERG & MONSEES GbR > Systeme f|r Wissenschaft und Technik > Steindamm 22 * D-28719 Bremen > Fon +49-421-646775 * Fax +49-421-646785