Anand, if you compare together they may not be the same and you will end up an error. This is what I would do. connect all 3 phases thru optoisolater and mux connect to pic CCP input and capture the speed. 1. select first phase capture and save it 2. do same thing on all other 2 now you have 3 variables that you can decide what to do with them. they may or may not be exact same values but will be very close. Andre Abelian -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu]On Behalf Of Anand Dhuru Sent: Friday, January 05, 2007 8:32 AM To: Piclist Subject: [PIC]: Phase failure detection Hi folks, I am building a circuit that needs to monitor the 3 phases in the mains, and detect if (a) any one phase fails, and (b) if the phases are connected improperly. After some search I found http://www.picbasic.org/forum/archiv...hp/t-2134.html to be pretty close to what I need. What would be the best way to go about it? Would this logic work? Detect positive edge on phase 1 Start Timer 0 Detect positive edge on phase 2 Read Timer 0 as variable 1 Detect positive edge on phase 3 Read Timer 0 as variable 2 Stop + Reset timer If Variable 1 is equal to (almost) = (Variable 2)/2 = 6.67 ms (for 50 hz) then all is ok. Start again. Am I on the right track, or is there a better/easier way to do this? Regards, Anand -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist