Vasile, If you dropped the voltage sufficiently you could detect a rise/fall above/below zero with 2 diodes but you'd probably have to limit/clamp the voltages. Then use one rising and one falling trigger pulse to generate RB0/RB1 interrupts. The interrupt routine would then simply read in Port B and depending whether bit 0 or bit 1 was set would indicate the positive or negative going zero-cross. Ted Mawson ----- Original Message ----- From: "Vasile Surducan" To: Sent: Wednesday, March 20, 2002 6:25 AM Subject: [PIC]: mains syncronizing > Good day/morning/night gentlemans. > > I have a question which may be defined as FAQ. > I have to synchronize a zero cross main signals with an output nibble on > both rising and falling edge. > I have done this in hardware using one 4093 and a few resistors, > capacitors and one zenner for detection and a 74ls373 for command. > I'm not sure if the best choice on a PIC will be to use rb0 as zero > cross detection interrupt. The nibble must be outputed > synchronously with the rising edge of the mains signal and shutted off > after a desired time period on the falling edge of the same signal. > I think also interrupt on change could satisfy this request but I want to > know other opinions. > The PIC will be 16F628. > > Thank you in advance and have a happy day. > > Vasile > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.