how can i calculate phase difference between two analog signals usings arduino uno
Measure the time difference between zero crossings and convert to degrees of phase difference.
I've deleted your other cross post @majeedjan.
Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.
Repeated cross posting will result in a suspension from the forum.
In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
1. From the two analog waves (Fig-1), get two zero crossing detectors of TTL level.
2. Use v1 to interrupt the MCU over INT0-pin and start TC0 to count 16 MHz clock of MCU.
3. Use v2 to Stop TC0.
4. Read counts of TC0 which is proportional to phase diffrence between v1 and v2.
5. Use the following Empirical Formula to find phase difference/power factor in degrees from the counts of Step-4.
pf (power factor) = cos theta = 0x2710 - 0x3A*(counts2/(0xB40xB4)).