I want to implement a phase detector in a circuit, and from my understanding it will generate a square wave that is proportional to the phase difference between the two inputs. How do I go about converting the square wave output into a constant voltage for feeding into an ADC? My electronics knowledge is very limited.